如何在msgbox vb.net中传递字符串值

时间:2013-02-24 18:44:03

标签: vb.net vbscript

我在vb.net和其他声明中有一个msgbox ..... 我想在其中传递一个字符串值,以显示字符串和消息文本,如下所示 -

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

有关此事的任何工作..........?

1 个答案:

答案 0 :(得分: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))