|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Verify the content of the textbox with multiple buttons on Form I am beginner in VB.net. I have a FORM with multiple button and one textbox. I wish that when I click on the button, we check if something has been entered in textbox. But how to check this? Should I have below code for each button? : Code: If textbox.text = "" Then messageBox.show("Empty Fields") |
#2
| |||
| |||
Re: Verify the content of the textbox with multiple buttons on Form Thank you to perform a little research on the forum, this same question comes up several times a week. Here is an example on a button Code: PrivateSub ManagementOfButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_1.Click, Button_1.Click, Button_2.Click, Button_3.Click, .......
__________________ Grand Theft Auto 4 PC Video Game |
#3
| |||
| |||
Re: Verify the content of the textbox with multiple buttons on Form Another problem arose: when I click on the button, the error message, but the action when the button is even launched. Here is my function: Code: Private Sub ManagementOfButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click, button2.Click If TextBox1.Text.Length < 5 Then MessageBox.Show("Thank you to comment") End If End Sub |
#4
| |||
| |||
Re: Verify the content of the textbox with multiple buttons on Form What action? At what point in your code? For there in your code I see too If you talk to any code you place after your End If Code: If ..... Then MsgBox("YourMsg") End If
__________________ The FIFA Manager 2009 PC Game |
#5
| |||
| |||
Re: Verify the content of the textbox with multiple buttons on Form SUB takes into account several buttons. If there is nothing in the textbox, type a message MessageBox.Show ("please save ...") but it is not the action of the start button, type EXIT, but it works not. I cannot put the ELSE, because SUB manages several buttons Here's the code: Code: Private Sub ManagementOfButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click, button2.Click If TextBox1.Text.Length < 5 Then MessageBox.Show("Thank you to comment") End If End Sub 'button 1 Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click webrowser.navigate(TextBox1.Text) End Sub 'button 2 Private Sub button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2.Click webrowser.navigate(TextBox1.Text) End Sub |
#6
| |||
| |||
Re: Verify the content of the textbox with multiple buttons on Form I do not see what prevents you from doing this: Code: Private Sub ManagementOfButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click, button2.Click If TextBox1.Text.Length < 5 Then MessageBox.Show("Thank you to comment") Else webrowser.navigate(TextBox1.Text) End If End Sub
__________________ The FIFA Manager 2009 PC Game |
![]() |
|
Tags: button, form, textbox, vb form |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mass Effect 3 Promo Content form 7 Barnes and Noble | Elwoody | Video Games | 7 | 19-03-2012 11:18 PM |
Excel/VBA: Copying text from UserForm Textbox to a Worksheet Textbox | Neil Ives | Software Development | 2 | 20-08-2010 01:23 AM |
RegEx - verify content and size | New ID | Software Development | 5 | 04-02-2010 01:27 AM |
Problem of html form with multiple submit buttons | ASHER | Software Development | 4 | 20-10-2009 05:31 PM |
Several submit buttons in the same form ? | Wiro | Software Development | 5 | 14-02-2009 10:29 PM |