|
-
Jul 8th, 2010, 09:27 AM
#1
Re: When textbox has 10 characters button1 click
 Originally Posted by JuggaloBrotha
stlaural, you could just do Button1.PerformClick() or if you prefer calling the method directly pass it an EventArgs.Empty instead of Nothing.
Code:
1.
Public Class Form1
2.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
3.
MessageBox.Show("Button1 has been clicked!")
4.
End Sub
5.
6.
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
7.
If TextBox1.Text.Length >= 10 Then
Button1.PerformClick()
'Or:
Button1_Click(Button1, EventArgs.Empty)
9.
End If
10.
End Sub
11.
End Class
Yeah, that would be cleaner. I tested quite fast as I'm at work 
thanks JuggaloBrotha
Alex
.NET developer
"No. Not even in the face of Armageddon. Never compromise." (Walter Kovacs/Rorschach)
Things to consider before posting.
Don't forget to rate the posts if they helped and mark thread as resolved when they are.
.Net Regex Syntax (Scripting) | .Net Regex Language Element | .Net Regex Class | DateTime format | Framework 4.0: what's new
My fresh new blog : writingthecode, even if I don't post much.
System: Intel i7 920, Kingston SSDNow V100 64gig, HDD WD Caviar Black 1TB, External WD "My Book" 500GB, XFX Radeon 4890 XT 1GB, 12 GBs Tri-Channel RAM, 1x27" and 1x23" LCDs, Windows 10 x64, ]VS2015, Framework 3.5 and 4.0 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|