Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Visual Studio .NET
VS.NET General Discussion
EventHandler and Binding?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Paszt, post: 4721, member: 56"] 1) As always with .NET there are several ways to accomplish this. One way would be to include each control's event in the handles clause. For Example:[code]Private Sub TextBoxs_KeyPress(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyPressEventArgs) _ Handles TextBox1.KeyPress, TextBox1.KeyPress, TextBox3.KeyPress '...[/code]Another way would be to add the event handler to all the textbox controls on the form during the load procedure:[code]Dim ctrl As Control For Each ctrl In Me.Controls If TypeOf ctrl Is TextBox Then Dim txtbx As TextBox = CType(ctrl, TextBox) AddHandler txtbx.KeyPress, AddressOf TextBoxs_KeyPress End If Next 'Then create the procedure with the same signature as the KeyPress event: Private Sub TextBoxs_KeyPress(ByVal sender As Object, _ ByVal e As System.Windows.Forms.KeyPressEventArgs) '...[/code] I don't understand what you're trying to do in the second question. [/QUOTE]
Insert quotes…
Verification
Post reply
Visual Studio .NET
VS.NET General Discussion
EventHandler and Binding?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom