[Help] Visibility

Posts 115 of 19 · Page 1 of 2
[Help] Visibility
How would i say..
If i had a textbox and a combo box
and i want there to be a button to proceed to the nxt form.
How would i make the button appear/enabled when the txtbox&comx are filled? Like, so the button is disabled when they are empty and i want it to be enabled when they are filled in.

So would it be like,
[php]If TextBoxX2.Text & ComboBox1.Text = "" Then
ButtonX1.Enabled = False
Else
ButtonX1.Enabled = True
End If[/php]
Ermmm Im not understand the question
......... Typical. Lol Read it again o.o
Im not quite understanding the question but here's a code you can try out (not sure if this is what you mean)

Place this under TextBox1 (or another number) _textchanged
Just double click on the textbox
Code:
If Not TextBox1.Text = "" Then
Button1.Enabled = True
Else
Button1.Enabled = False
TextBox1.Text = ""
End If
That could work, but in this case, i need TextBox AND Combo box to be filled in for ButtonX1 to be enabled o.o
[php]

'Put this in both text and comx change events

If Not Trim(TextBox1.Text) = "" And Not Trim(ComboBox1.Text) = "" Then
Button1.Enabled = True
Else
Button1.Enabled = False
End If


[/php]

So it should look like this

[php]
Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged
If Not Trim(TextBox1.Text) = "" And Not Trim(ComboBox1.Text) = "" Then
Button1.Enabled = True
Else
Button1.Enabled = False
End If
End Sub


Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If Not Trim(TextBox1.Text) = "" And Not Trim(ComboBox1.Text) = "" Then
Exit Sub
Else
Button1.Enabled = True
End If
End Sub
[/php]





K thanks i'll see if it works.
No its really simple
(Put under button1 and form 1)

If checkbox1.checked '(or radiobutton1, etc) = true then
button1.enabled = true
else
button1.enabled = false
*groan* you dont get it! NOT CHECKBOX! i want the comx and textbox to be filled in before i can press OK
BTW Nextgen it dosnt work o.o
ah i see. ill look into it
ok thanks zman
So /close, does it work?
No it doesnt >.< still resolving
Quote Originally Posted by Invidus View Post
No it doesnt >.< still resolving
[php]Dim number as integer
Dim number1 as integer


If TextBoxX2.Text is nothing Then


Else
number = 1

End If

If ComboBox1.Text is nothing Then

Else
number1 = 1
End If


if number = 1 and number1 = 1 then
ButtonX1.Enabled = True
else
ButtonX1.Enabled = False
end if[/php]

Or you can use = "" instead of is nothing....

I think this works above(it might be some wrong spelling because i just wrote it in mpgh's post form, not in vb)
Posts 115 of 19 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?