0

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..........?

1 Answer 1

4
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))
Sign up to request clarification or add additional context in comments.

1 Comment

@user1897472: That was added to give an example.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.