Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    HiddenoO's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Anchorage, AK
    Posts
    840
    Reputation
    33
    Thanks
    212
    My Mood
    Devilish

    VB.NET Multiple Strings In a Textbox?

    Well I ran into a problem in VB.net.. I'm trying to make it where 2 different textboxes will accept multiple strings and a MsgBox would still popup..Also i'm using a method where when the program closes the text inside of the textboxes will be saved if the checkbox is checked.
    [php]
    If (textbox1.text = "example" and textbox2.text = "example2") or (textbox1.text = "owie" and textbox2.text = "yo") or (textbox1.text = "rage" and textbox2.text = "noobs")
    //and so on..and after that I have
    Then
    If CheckBox1.Checked = True Then
    My.Settings.Text1 = Textbox1.Text
    My.Settings.Save()
    My.Settings.Reload()
    End If
    If CheckBox1.Checked = True Then
    My.Settings.Text2 = Textbox2.Text
    My.Settings.Save()
    My.Settings.Reload()
    End If
    MsgBox("Example of use.", MsgBoxStyle.Information, "")
    ToolStripStatusLabel5.Text = "-hiya"
    Else
    MsgBox("Information is incorrect", MsgBoxStyle.Critical, "")
    [/php]
    But every time I enter the info, I always get the Information is incorrect message box..I have tried many different ways and googled it, but i always get the same result..Any ideas?
    /

  2. #2
    RagedYet's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    California
    Posts
    220
    Reputation
    -3
    Thanks
    34
    My Mood
    Devilish
    i just tested this for you and it works as is suppost to

    Code:
            If (TextBox1.Text = "example" And TextBox2.Text = "example2") Or (TextBox1.Text = "owie" And TextBox2.Text = "yo") Or (TextBox1.Text = "rage" And TextBox2.Text = "noobs") Then
                If CheckBox1.Checked = True Then
                   My.Settings.Text1 = Textbox1.Text 
                    My.Settings.Text2 = Textbox2.Text 
                    My.Settings.Save()
                    My.Settings.Reload()
                End If
                MsgBox("Example of use.", MsgBoxStyle.Information, "")
                ToolStripStatusLabel5.Text = "-hiya"
            Else
                MsgBox("Information is incorrect", MsgBoxStyle.Critical, "")
            End If



  3. #3
    HiddenoO's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Anchorage, AK
    Posts
    840
    Reputation
    33
    Thanks
    212
    My Mood
    Devilish
    Quote Originally Posted by RagedYet View Post
    i just tested this for you and it works as is suppost to

    Code:
            If (TextBox1.Text = "example" And TextBox2.Text = "example2") Or (TextBox1.Text = "owie" And TextBox2.Text = "yo") Or (TextBox1.Text = "rage" And TextBox2.Text = "noobs") Then
                If CheckBox1.Checked = True Then
                   My.Settings.Text1 = Textbox1.Text 
                    My.Settings.Text2 = Textbox2.Text 
                    My.Settings.Save()
                    My.Settings.Reload()
                End If
                MsgBox("Example of use.", MsgBoxStyle.Information, "")
                ToolStripStatusLabel5.Text = "-hiya"
            Else
                MsgBox("Information is incorrect", MsgBoxStyle.Critical, "")
            End If
    wth..it doesn't work for me.

  4. #4
    RagedYet's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    California
    Posts
    220
    Reputation
    -3
    Thanks
    34
    My Mood
    Devilish
    Quote Originally Posted by HiddenoO View Post
    wth..it doesn't work for me.
    Works just fine for me so yeah your error is not there.



  5. #5
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    805
    Reputation
    125
    Thanks
    1,794
    My Mood
    Doh
    Quote Originally Posted by HiddenoO View Post
    Well I ran into a problem in VB.net.. I'm trying to make it where 2 different textboxes will accept multiple strings and a MsgBox would still popup..Also i'm using a method where when the program closes the text inside of the textboxes will be saved if the checkbox is checked.
    [php]
    If (textbox1.text = "example" and textbox2.text = "example2") or (textbox1.text = "owie" and textbox2.text = "yo") or (textbox1.text = "rage" and textbox2.text = "noobs")
    //and so on..and after that I have
    Then
    If CheckBox1.Checked = True Then
    My.Settings.Text1 = Textbox1.Text
    My.Settings.Save()
    My.Settings.Reload()
    End If
    If CheckBox1.Checked = True Then
    My.Settings.Text2 = Textbox2.Text
    My.Settings.Save()
    My.Settings.Reload()
    End If
    MsgBox("Example of use.", MsgBoxStyle.Information, "")
    ToolStripStatusLabel5.Text = "-hiya"
    Else
    MsgBox("Information is incorrect", MsgBoxStyle.Critical, "")
    [/php]
    But every time I enter the info, I always get the Information is incorrect message box..I have tried many different ways and googled it, but i always get the same result..Any ideas?
    /
    I am no VB coder but this code has nothing to do with multiple strings in the same text box, all your doing is checking if texbox = "example" and textbox2 = "example2"

    then if thats true your checking if the checkbox is ticked, if the first arguments is false (meaning your 2 textboxes does NOT = "example" and "example2" or "rage" and "noobs" then it wont even check to see if your checkbox is ticked or not, which means you will get error message... just out of interested how is this anything to do with multiple strings in a textbox?

  6. #6
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,843
    Reputation
    425
    Thanks
    8,616
    Code:
    If TextBox1.Text = "Username" And TextBox2.Text = "Password" Then
    
         Msgbox("Success")
    
         If CheckBox1.Checked Then
                My.Settings.Text1 = Textbox1.Text
                My.Settings.Text2 = Textbox2.Text
                My.Settings.Save()
         End If
    
    Else
    
         Msgbox("Failure")
    
    End If

  7. #7
    HiddenoO's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Anchorage, AK
    Posts
    840
    Reputation
    33
    Thanks
    212
    My Mood
    Devilish
    Quote Originally Posted by Departure View Post
    I am no VB coder but this code has nothing to do with multiple strings in the same text box, all your doing is checking if texbox = "example" and textbox2 = "example2"

    then if thats true your checking if the checkbox is ticked, if the first arguments is false (meaning your 2 textboxes does NOT = "example" and "example2" or "rage" and "noobs" then it wont even check to see if your checkbox is ticked or not, which means you will get error message... just out of interested how is this anything to do with multiple strings in a textbox?
    Huh, I must've mistook it for something else..




    Quote Originally Posted by ᴺᴼᴼᴮ View Post
    Code:
    If TextBox1.Text = "Username" And TextBox2.Text = "Password" Then
    
         Msgbox("Success")
    
         If CheckBox1.Checked Then
                My.Settings.Text1 = Textbox1.Text
                My.Settings.Text2 = Textbox2.Text
                My.Settings.Save()
         End If
    
    Else
    
         Msgbox("Failure")
    
    End If
    And this didn't work, I still get the error message.
    /

  8. #8
    skiiiz's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    119
    Reputation
    10
    Thanks
    11
    Code:
    If (TextBox1.Text = "user1" & TextBox2.Text = "pass1") or (TextBox1.Text = "user2" & TextBox2.Text = "pass2") Then 
     If CheckBox1.Checked = True Then 
                    My.Settings.Text1 = Textbox1.Text 
                    My.Settings.Save() 
                    My.Settings.Reload() 
                ElseIf CheckBox1.Checked = False Then 
                    My.Settings.Text2 = Textbox2.Text 
                    My.Settings.Save() 
                    My.Settings.Reload() 
                End If 
                MsgBox("Example of use.", MsgBoxStyle.Information, "") 
                ToolStripStatusLabel5.Text = "-hiya" 
            Else 
            MsgBox("Information is incorrect", MsgBoxStyle.Critical, "")
    End If
    That should do it. I also took the liberty of cleaning your code up.
    Also telling us the error would help.

  9. #9
    ChanceOfHax's Avatar
    Join Date
    Sep 2010
    Gender
    male
    Location
    PlayerInfo* pPlayer = SearchPlayerByIndex(ChanceOfHax);
    Posts
    113
    Reputation
    3
    Thanks
    5
    My Mood
    Sneaky
    U have to run ur .exe manually not in vb debug^^
    Than it should work

  10. #10
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    805
    Reputation
    125
    Thanks
    1,794
    My Mood
    Doh
    Code:
    If CheckBox1.Checked = True Then 
                    My.Settings.Text1 = Textbox1.Text 
                    My.Settings.Save() 
                    My.Settings.Reload() 
                ElseIf CheckBox1.Checked = False Then 
                    My.Settings.Text2 = Textbox2.Text 
                    My.Settings.Save() 
                    My.Settings.Reload() 
                End If
    Once again im no Vb coder but I dont think you need to check twice if the checkbox is checked or not, it either is or it is'nt.....

    change "ElseIf CheckBox1.Checked = False Then" to just "Else" because it must be false if its not true(which you checked in the first part). Even better I would be using the case statment..

    example
    Code:
    Select case checkbox1.checked
     Case True
       My.Settings.Text1 = Textbox1.Text 
       My.Settings.Save() 
       My.Settings.Reload()
     Case False
       My.Settings.Text2 = Textbox2.Text 
       My.Settings.Save() 
       My.Settings.Reload()
    end select
    I don't code in vb and this could be incorrect, but you get the idea and is more readable than checking a checkbox multiple times.

    //Edit
    Actually your better of telling us what you want to achieve and im sure the vb coders here will help you out, And I also agree that telling us the error would be a big help
    Last edited by Departure; 11-16-2010 at 05:26 AM.

  11. #11
    HiddenoO's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Anchorage, AK
    Posts
    840
    Reputation
    33
    Thanks
    212
    My Mood
    Devilish
    Quote Originally Posted by Departure View Post
    Code:
    If CheckBox1.Checked = True Then 
                    My.Settings.Text1 = Textbox1.Text 
                    My.Settings.Save() 
                    My.Settings.Reload() 
                ElseIf CheckBox1.Checked = False Then 
                    My.Settings.Text2 = Textbox2.Text 
                    My.Settings.Save() 
                    My.Settings.Reload() 
                End If
    Once again im no Vb coder but I dont think you need to check twice if the checkbox is checked or not, it either is or it is'nt.....

    change "ElseIf CheckBox1.Checked = False Then" to just "Else" because it must be false if its not true(which you checked in the first part). Even better I would be using the case statment..

    example
    Code:
    Select case checkbox1.checked
     Case True
       My.Settings.Text1 = Textbox1.Text 
       My.Settings.Save() 
       My.Settings.Reload()
     Case False
       My.Settings.Text2 = Textbox2.Text 
       My.Settings.Save() 
       My.Settings.Reload()
    end select
    I don't code in vb and this could be incorrect, but you get the idea and is more readable than checking a checkbox multiple times.

    //Edit
    Actually your better of telling us what you want to achieve and im sure the vb coders here will help you out, And I also agree that telling us the error would be a big help
    Well for one I am experienced in VB8..The code is already checking if checkbox1 is checked or not, and if it is it will save the text within textbox1.
    and to show you:
    [php]
    If CheckBox1.Checked = True Then
    My.Settings.Text1 = Textbox1.Text
    My.Settings.Save()
    My.Settings.Reload()
    ElseIf CheckBox1.Checked = False Then
    My.Settings.Text2 = Textbox2.Text
    My.Settings.Save()
    My.Settings.Reload()
    End If [/php]
    And I don't receive and error within VB it's just something that I guess i'm doing wrong, and I don't see what wrong with it. When I try and check the box to save the settings and press button1 the error message I want to popup comes up instead.

  12. #12
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    805
    Reputation
    125
    Thanks
    1,794
    My Mood
    Doh
    then wont you need to do 2 "end if" because you are checking twice? thats why I suggested you only need to check the checkbox once...

    or atleast just try this
    Code:
    If CheckBox1.Checked = True Then 
                    My.Settings.Text1 = Textbox1.Text 
                    My.Settings.Save() 
                    My.Settings.Reload() 
               Else
                    My.Settings.Text2 = Textbox2.Text 
                    My.Settings.Save() 
                    My.Settings.Reload() 
                End If
    Last edited by Departure; 11-16-2010 at 11:33 PM.

  13. #13
    skiiiz's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Posts
    119
    Reputation
    10
    Thanks
    11
    Make sure the My.Settings strings are accessible.
    Departure, I'm just trying to get the code up and working.

    Anyways, do you receive an unhandled error?

  14. #14
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    805
    Reputation
    125
    Thanks
    1,794
    My Mood
    Doh
    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If TextBox1.Text = "Example" And TextBox2.Text = "Example2" Then
                If CheckBox1.Checked Then
                    MessageBox.Show("Checkbox is ticked do your code here")
                Else
                    MessageBox.Show("Checkbox is NOT ticked do what ever here")
                End If
            Else
                MessageBox.Show("Textbox1 and textbox2 does not = Example and Example2... skipping checkbox check")
            End If
        End Sub
    I dont code in vb so this probably could be written better, but it works and thats what you wanted....
    just take note of how we use End if....

  15. #15
    HiddenoO's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    Anchorage, AK
    Posts
    840
    Reputation
    33
    Thanks
    212
    My Mood
    Devilish
    Quote Originally Posted by Departure View Post
    Code:
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            If TextBox1.Text = "Example" And TextBox2.Text = "Example2" Then
                If CheckBox1.Checked Then
                    MessageBox.Show("Checkbox is ticked do your code here")
                Else
                    MessageBox.Show("Checkbox is NOT ticked do what ever here")
                End If
            Else
                MessageBox.Show("Textbox1 and textbox2 does not = Example and Example2... skipping checkbox check")
            End If
        End Sub
    I dont code in vb so this probably could be written better, but it works and thats what you wanted....
    just take note of how we use End if....
    I know i'm using End If correctly..
    I think I might have cut the code off where I started using it, but I think the problem might be because I have to many things for the textbox to accept.

Page 1 of 2 12 LastLast

Similar Threads

  1. Multiple HORDE 85's AND EVERY BATTLE.NET game on the account
    By Nekrage in forum Selling Accounts/Keys/Items
    Replies: 48
    Last Post: 04-23-2011, 10:24 PM
  2. Selling multiple RSBot.net auth codes for RSGP
    By Auth in forum Selling Accounts/Keys/Items
    Replies: 6
    Last Post: 03-28-2011, 01:23 AM
  3. [Vb.net] Count the # of "Hi" in a textbox?
    By ppl2pass in forum Visual Basic Programming
    Replies: 1
    Last Post: 07-09-2010, 03:52 PM
  4. Me r MAD.. GONNA DDOS WarRock.net :)
    By System79 in forum WarRock - International Hacks
    Replies: 14
    Last Post: 06-19-2006, 05:06 PM
  5. Gangsterhood.net
    By supatanka in forum Hack Requests
    Replies: 0
    Last Post: 01-22-2006, 01:42 PM