p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Visual Basic 2008 Professionals (http://p2p.wrox.com/forumdisplay.php?f=359)
-   -   vb 2008 exsp (http://p2p.wrox.com/showthread.php?t=70289)

Dracitus August 27th, 2008 11:39 AM

vb 2008 exsp
How Do You make a line Loop Like If Textbox1.text = "1" Then goto line 2: Line 2 If Textbox3 . text = 2 then goto lastline My question is in console application i want to be able to hit 1 then it gose to line1 hit 2 gose to Lastline bout i want the console to read visual basic 2008 express edtion textboxes[?]

Imposiable is Always Posibles... No matter what it takes.

BrianWren August 27th, 2008 02:15 PM

To post code, click the [[u]#</u>] button. It inserts a pair of tags; put your code between those tgs and it will be fixed spacing, and will be presented literally as you type it.

That bold, red, weird-font is really hard to read...
Your best bet IMO is a Select Case structure:

    ' Get the input.  In this case it would be in the variable Answer
    ' Then use it in a Select Case statement:

    Select Case Answer
        Case 1
            ' Put the code here that would be at the GoTo Line 1
            ' area.  Alternately, write a routine like:
        Case 2
            ' Put the code here that would be at the GoTo Line 2
            ' area.  Alternately, write a routine like:
        Case 3
            ' Put the code here that would be at the GoTo Line 3
            ' area.  Alternately, write a routine like:
    End Select

    Jumping around with GoTo methods is considered very bad form. It makes programs really hard to read (when trying to figure out what they are supposed to be doing), really hard to maintain (if you need to modify how they work or if you have to repair an error, typo, whatever).

If you go to a job interview, and your portfolio has samples with

    If Answer = 1 Then
        GoTo 1
    ElseIf Answer = 2 Then
        GoTo 2
    ElseIf Answer = 3 Then
        GoTo 3
    End If

    You can be guaranteed to not get the job...

PS: It is “goes,” not “gose,” and “I” is capitalized when talking about yourself.

And, in reality, some things are actually impossible...

GMorris September 27th, 2008 10:56 AM

As opposed to "Imposiable" and possible as opposed to "Posibles"? Strange, since the OP has "USA" as place where he/she lives. I really hope that residents of the US who are attempting to handle something like VB.NET, or ANY programming would have somewhat better of an education and a much better hold on spelling/grammar! If it's not education or not having English as a native language, it's got to be just plain laziness, I mean we have a spell checker at our disposal...

All times are GMT -4. The time now is 10:53 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.