Results 1 to 5 of 5
  1. #1
    Darkwhason's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Mx
    Posts
    353
    Reputation
    -1
    Thanks
    15
    My Mood
    Scared

    VB 2010 For..Next Help Request

    Well as my homework i had to investigate about the instruction For....Next and then make a basic program witch im having a hard time finding information about how to even do it.

    I Know that For....Next is used to do a instruction a selected amount of times .

    I'm trying to make a basic program on VS 2010 With only 1 txtbox (I'm trying to use For ..Next to have to type on the same txtbox 3 times without having to add more boxes i don't know if it possible :C , but how i tryed it , it ends up doing the amount of turns i gived but without even giving me the ability to type on the txtbox again i type 1 time and it finished and when i add a MsgBox it ends up poping 3 of them without leting me type.

    Dim Contador As Integer
    Dim SM9 As Double
    Dim SIM As Double
    For Contador = 1 To 3

    Next
    If Val(txtn.Text) Mod 9 = 0 Then
    SM9 = SM9 + Val(txtn.Text)
    End If

    If Val(txtn.Text) Mod 2 = 0 = False Then
    SIM = SIM + Val(txtn.Text)
    End If
    txtn.Text = String.Empty




    lblsim.Text = SIM
    lblsumam9.Text = SM9

    I have changed the spot of the code multiple times :C

  2. #2
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    Basically no, not the way you're doing it.

    A loop is designed to execute some ## of times.

    The GUI is designed to take input at any time.

    They don't really mix. The loop will continue loop, and when will the user have time to type? It doesn't work.


    Maybe try using InputBox?

    Also, If Val(txtn.Text) Mod 2 = 0 = False Then, looks funny. Why are there 2 == signs? Are you trying to find even/odd numbers or what? You should only need one =.
    Last edited by abuckau907; 10-14-2013 at 12:10 AM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  3. #3
    Darkwhason's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Mx
    Posts
    353
    Reputation
    -1
    Thanks
    15
    My Mood
    Scared
    Quote Originally Posted by abuckau907 View Post
    Basically no, not the way you're doing it.

    A loop is designed to execute some ## of times.

    The GUI is designed to take input at any time.

    They don't really mix. The loop will continue loop, and when will the user have time to type? It doesn't work.


    Maybe try using an InputBox?

    Also, If Val(txtn.Text) Mod 2 = 0 = False Then, looks funny. Why are there 2 == signs? Are you trying to find even/odd numbers or what? You should only need one =.
    Trying to find odd numbers that's the first thing that comed up on my main and tryed to try something different lol and it worked.

    Also abou Input Box i was looking for a method and well i think that's it thanks alot , i will try it tomarrow since im really sleepy atm

  4. #4
    abuckau907's Avatar
    Join Date
    Dec 2012
    Gender
    male
    Location
    other side of the wire
    Posts
    1,342
    Reputation
    162
    Thanks
    239
    My Mood
    Cold
    kk. good luck. Update post if you figure it out / need help : )

    Code:
    Dim userInput As String = "" 
    Dim userInputINT As Integer = 0
    
    For xx As Int32 = 1 to 3
    
      userInput = InputBox("Please enter a number","The Message Title", "0") '// 0 is default number
      userInputINT = CInt(userInput)
      
      If ******
       ...
    Next xx
    edit: There is no error-checking, so if the user types "abcd" for the number, the call to CInt() will not be able to convert it to a number, and fail. Just saying.
    Last edited by abuckau907; 10-14-2013 at 12:19 AM.
    'Some things that can be counted, don't matter. And some things that matter, can't be counted' - A.E.
    --
     

    My posts have some inaccuracies/are wrong/wrong keyword(s) used.
    They're (maybe) pretty close, and I hope they helped you, not created confusion. Take with grain of salt.

    -if you give rep, please leave a comment, else it means less.

  5. #5
    Darkwhason's Avatar
    Join Date
    Jan 2011
    Gender
    male
    Location
    Mx
    Posts
    353
    Reputation
    -1
    Thanks
    15
    My Mood
    Scared
    Quote Originally Posted by abuckau907 View Post
    kk. good luck. Update post if you figure it out / need help : )

    Code:
    Dim userInput As String = "" 
    Dim userInputINT As Integer = 0
    
    For xx As Int32 = 1 to 3
    
      userInput = InputBox("Please enter a number","The Message Title", "0") '// 0 is default number
      userInputINT = CInt(userInput)
      
      If ******
       ...
    Next xx
    edit: There is no error-checking, so if the user types "abcd" for the number, the call to CInt() will not be able to convert it to a number, and fail. Just saying.
    Well Thanks a lot got the simple program done and also i kind of learned how to use InputBoxes a bit ty

Similar Threads

  1. [Solved] help request for crossfire eu
    By sasaaaaaaaaaaaa in forum CrossFire Help
    Replies: 6
    Last Post: 01-02-2013, 08:20 AM
  2. Request for Hacks Help
    By cstorm in forum Vindictus Help
    Replies: 12
    Last Post: 08-10-2011, 02:34 PM
  3. Request for serious help
    By Hitman in forum XBOX Customizing & Modding
    Replies: 0
    Last Post: 08-08-2011, 05:07 AM
  4. [Help Request] Looking for help with PS CS5
    By Minato_Nagato in forum Combat Arms Mod Discussion
    Replies: 3
    Last Post: 10-28-2010, 05:36 PM
  5. [Help Request] Does PS CS5 work for texture rez modding?
    By Minato_Nagato in forum Combat Arms Mod Discussion
    Replies: 3
    Last Post: 10-24-2010, 10:57 PM