LEARN VB.NET 2008 L2 TRICKS WITH MES BOXES & VARIABLE TEXTGymjunnky.com Welcome's you to learn VB.NET 2005/2008 this is tutorial no2 and my name is Gym_ In this short tutorial I'm going to demonstrate popup boxes with variable input as well as the If statement Please take note that all my tutorials start off vey basic and slowly get more advanced so if you do not understand some of the functions then please revert back to previous tutorials. So let's get started,, Open your 2005 or 2008 Vb.NET edition and select new Project Then were going to just change the name to popup call your project whatever you like 1st thing we need to do is grab ourselves a button,, and draw a rectangle on our form were we would like it to go Then were going to double click on the button and inside were going to right MSGBOX "Welcome to vb.net" Make shore you use quotation marks as this tells vb that this is an actual quote of what is to be said. Then click the run or play button and click on the button we made on the front of the form Ok there ya have it welcome to vb.net Ok lets spice this up a little let's make the text inside this message box variable One way of doing this is adding a textbox to our form so let's do that now,,, click the icon textbox and draw a rectangle on the form. You can choose whether to have mutable lines by clicking the little arrow button and then ticking the multi line box I'm just going to change the colour of our form here so we can see this a little better Ok so click the button that we made on the form and erase what we wrote And let's see what happens without the quotation marks Lets write in there MSGBOX (Textbox1.Text) Then hit the play button Then we just type in something say 123 And hit bottom 1 and there ya have it,, Msgbox 123 Lets try something ells Hello how ya doing So there ya go a way of making the message box variable input which can be handy for heaps of different things like telling you the results of scores and different inputs Ok let's try something different again Lets make 3 check boxes on our form Then go back and click inside the button again,, erase what we have written and lets a message box with the if statement Inside the button lets right if checkbox1.checked then Msgbox " You have clicked box one End if Then we right If textbox2.checked then Msgbox " you have clicked box 2" End if If checkbox3.checked then Visit gymjunnky.com for more vids bit of shameless promotion there..lol But you notice ive done something wrong.. yerp that's Wright i did give it the command of what to do so lets fill that in with MSGBOX" End if Ok lets see what happens if we remove these and Ifs As you can see the stamen is underlined saying ya stuffed something up and if you hover your mouse over it it says If must end with matching end if So lets replace the end ifs and then run the program Lest click the button and as you see nothing happens So lets click number 1 ,, and as you see our statements are showing up,, Ok so what happens if we click all 3 There ya go shows all 3 of our statements,, so there ya go you can use that for lots of different things and hopefully get some use outer it if not at lest some better understanding of how the if statement and making the text variable in a message box,, remember all of my tutorials as well as the source codes to these programs are on my website as well as programming resource programs and help forms for if you have a question then jump on in and ask away,, this has been tutorials 2 of learn VB.NET my name is Gym and ill catch ya next time peace out ppls code pour embarquer la vidéo : >>> http://www.youtube.com/embed/xsWhnQTnssU <<< |