[HELP] Two Ifs[Solved]

Posts 1–15 of 20 · Page 1 of 2
[HELP] Two Ifs[Solved]
Is there any way to do this sort of thing?

Code:
If TextBox2.Text = "test" & TextBox1.Text = "test" Then
MsgBox("Test")
        Else
MsgBox("Fail")
End If
Thanks.
Code:
If TextBox2.Text = "test" and TextBox1.Text = "test" Then
MsgBox("Test")
        Else
MsgBox("Fail")
End If
Ha , So Close

[php]
If TextBox2.Text = "test" And TextBox1.Text = "test" Then
MsgBox("Test")
Else
MsgBox("Fail")
End If
[/php]

And not &

and grrrrrrrr lolland by one second, really

Beat you nextgen, mine is shorter
[php]
If TextBox2.Text = "test" = TextBox1.Text Then
MsgBox("Test")
Else
MsgBox("Fail")
End If
[/php]
Quote Originally Posted by mnpeepno2 View Post
Beat you nextgen, mine is shorter
[php]
If TextBox2.Text = "test" = TextBox1.Text Then
MsgBox("Test")
Else
MsgBox("Fail")
End If
[/php]
Fail ... Conversion from "test" to boolean failed !!! LOL

Code:
MsgBox(If(Not TextBox1.Text = "test" And TextBox2.Text = "test", "Fail", "Test"))
I Won
I do
Code:
If Textbox1.text = "test" Then
    If Textbox2.text = "test" Then
Msgbox("Test")
Else
Msgbox("Failed")
End if
End If
Quote Originally Posted by flameswor10 View Post
I do
Code:
If Textbox1.text = "test" Then
    If Textbox2.text = "test" Then
Msgbox("Test")
Else
Msgbox("Failed")
End if
I only use this if I need error specific message boxes, i.e

[php]

If TxtUsername.Length > 0 Then
if TxtPassword.Length > 0 then
'do Login'
else
msgbox("Please enter a password first!", vbExclamation, "Error: No Password")
end if
else
msgbox("Please enter a username!", vbExclamation, "Error: No Username")
end if

[/php]

But for situations where you don't need a specific "else", this is sorta inefficient + confusing as hell to follow later on when you don't remember exactly what it was supposed to do
That's inefficient though

And mnpeep your only works if the textbox text has to be the same.
Whoops i forgot an endif LOL
you don't have an idea how annoying it is for me to read code not correctly indented.

Code:
If Textbox1.text = "test" Then
    If Textbox2.text = "test" Then
         Msgbox("Test")
    Else
         Msgbox("Failed")
    End if
End If
like this you would not forget that endif im pretty sure X:
Quote Originally Posted by 'Bruno View Post
you don't have an idea how annoying it is for me to read code not correctly indented.

Code:
If Textbox1.text = "test" Then
    If Textbox2.text = "test" Then
         Msgbox("Test")
    Else
         Msgbox("Failed")
    End if
End If
like this you would not forget that endif im pretty sure X:
Although I completely agree that it's a lot easier to read properly indented code, it is quite annoying trying to indent it on a forum where "Tab" doesn't do indenting, hitting space to indent is annoying. So either you have to open VB and type out the snippet and then C+P it back in, or do what i do and do space indenting which is annoying as hell on a long snippet.
I won too.

Boolean. Ha Ha/
im still a winner in my heart

MsgBox(If(both TextBox1.Text And TextBox2.Text = "test", "Fail", "Test"))
suck that
In this case I reckon NEXTGENS code is more appropriate for the question. As for mnpeep he wants the password to be test. The user can make the password on both boxes "abc" and it will accept in.
Posts 1–15 of 20 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us