0

我在 vb.net 和 else 语句中有一个 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

有什么解决方法………​​…?

4

1 回答 1

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))
于 2013-02-24T18:52:14.487 回答