2013-02-24 80 views
0

我有一个msgbox在vb.net和其他语句..... 我想传递一个字符串值来显示字符串和消息文本像下面一样 -如何传递一个字符串值在一个msgbox vb.net

Normal 

    msgbox("student is not eligible for the company") 

TO 

    MSGBOX([string]"is not eligible for the company") 

RESULT 

    Anthony is not eligible for the company 

任何解决此问题..........?

回答

4
dim StudentName as string 
StudentName = "Student" 

If (specificStudent) Then 
    StudentName = "SpecificName" 
End If 

MsgBox(StudentName + " is not eligible") 

编辑:另外,你可以使用string.Format这里

dim StudentName as string 
StudentName = "Student" 

If (specificStudent) Then 
    StudentName = "SpecificName" 
End If 

'I suppose string.format works same way in vb.net, as it does in c#  
MsgBox(String.Format("{0} is not eligible", StudentName)) 
+0

did'nt需要的情况下,如果你的位工作的String.Format由于 – CrashOverride 2013-02-24 19:08:37

+0

@ user1897472:已添加到举一个例子。 – shahkalpesh 2013-02-24 19:29:20