Home and Learn: VB Net Course
Whenever you have used the Message Box, you have done so like this:
MessageBox.Show( "Your Message Here" )
So you type the word "MessageBox" then a full stop. Double click the "Show" method on the menu that appears. Then type a round bracket. You should get a rather long and complex tool tip appearing:
This is telling you that there are 21 different ways to use the MessageBox function. You are currently viewing the first of these (1 of 21). You can click on the up and down arrows to scroll through then all, if you want.
The first one, though, is "text As String". The text in question is the text that will appear for your message - the message itself, in other words. If you click through to 3 of 21, you see there is another option: "caption As String". This sets the caption at the very top of the message box.
So if your message box function was this:
MessageBox.Show( "This menu will Undo an Operation", "Undo" )
You would get this message box popping up:
Each option for your message box is separated by a comma. If you type a comma after the "Undo", and then a space, you'll get another pop-up menu. On this menu, you can specify which buttons you want on your message box:
You only need the OK button on your message boxes. Double click this item, then type another comma, and hit the spacebar. Yet another pop-up menu will appear. On this menu, you can specify the symbol that appears in the message box:
It's up to you which symbol you choose. Experiment with all of them and see what they look like. In the image below, we've gone for the Information symbol:
The message box above is a lot better than the first one we tried.
In the next section, we'll move on to Conditional Logic
Explore Conditional Logic in VB .NET -->
Back to the VB NET Contents Page
Back to the VB NET Contents Page
Email us: enquiry at homeandlearn.co.uk