CrashOverride
CrashOverride

Reputation: 338

how to pass a string value in an msgbox vb.net

i have a msgbox in vb.net and in else statement..... i want to pass an string value in it to display the string and the message text like below-

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

any work around on this..........?

Upvotes: 0

Views: 21401

Answers (1)

shahkalpesh
shahkalpesh

Reputation: 33476

dim StudentName as string
StudentName = "Student"

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

MsgBox(StudentName + " is not eligible")

EDIT: Also, you could use string.Format here

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))

Upvotes: 4

Related Questions