473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Events with controlarrays

Hello again,

with the controlarrays is it possible to let's say make two textboxes and
then with one lost_focus event handle both boxes?

I'd like to input two values, one in each box. When the user leaves which
ever box the calculated value should be updated.

For now I am doing this with two events, one for each box. would reduce the
size if I could do it it one.

Anybody have a sample code?
Thanks,

Jerry
Nov 21 '05 #1
2 839
Hi,

Add the extra controls to the event procedures handles.

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged

End Sub

or use addhandler

For x As Integer = 0 To 4
Dim txt As New TextBox
txt.Location = New Point(20, 20 * (x + 1))
Me.Controls.Add(txt)
AddHandler txt.TextChanged, AddressOf TextBox1_TextChanged
Next
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs)

End Sub

Ken
---------------------
"Jerry" <je***********@gmx.net> wrote in message
news:dg*************@news.t-online.com...
Hello again,

with the controlarrays is it possible to let's say make two textboxes and
then with one lost_focus event handle both boxes?

I'd like to input two values, one in each box. When the user leaves which
ever box the calculated value should be updated.

For now I am doing this with two events, one for each box. would reduce
the size if I could do it it one.

Anybody have a sample code?
Thanks,

Jerry

Nov 21 '05 #2
Wow!

That easy?
Thanks,

Jerry
"Ken Tucker [MVP]" <vb***@bellsouth.net> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

Add the extra controls to the event procedures handles.

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles TextBox1.TextChanged, TextBox2.TextChanged

End Sub

or use addhandler

For x As Integer = 0 To 4
Dim txt As New TextBox
txt.Location = New Point(20, 20 * (x + 1))
Me.Controls.Add(txt)
AddHandler txt.TextChanged, AddressOf TextBox1_TextChanged
Next
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs)

End Sub

Ken
---------------------
"Jerry" <je***********@gmx.net> wrote in message
news:dg*************@news.t-online.com...
Hello again,

with the controlarrays is it possible to let's say make two textboxes and
then with one lost_focus event handle both boxes?

I'd like to input two values, one in each box. When the user leaves which
ever box the calculated value should be updated.

For now I am doing this with two events, one for each box. would reduce
the size if I could do it it one.

Anybody have a sample code?
Thanks,

Jerry


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vince C. | last post by:
Hi. I'd like to trap ADO Recordset object events in my ASP script (either VBS or JS, no preference). I've tried (in VBS) writing a Sub rs_RecordChangeComplete( adReason, cRecords, pError,...
8
by: Edward Diener | last post by:
Is it possible for a derived class to override a property and/or event of its base class ?
3
by: Sasha | last post by:
Hi everyone, Here is my problem: I have the following classes: - DataNode - this class is designed to hold some data and will be contained in a tree like data structure DataTree. When...
6
by: Saso Zagoranski | last post by:
Hi! How can I unregister all the events registered to a control? I have seen a piece of code in another thread, which gets all the registered handlers for a specific event. Let's say I have a...
14
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
4
by: LP | last post by:
Hello! I am still transitioning from VB.NET to C#. I undertand the basic concepts of Delegates, more so of Events and somewhat understand AsyncCallback methods. But I need some clarification on...
11
by: Nicky Smith | last post by:
Hello, I'm studying a book on VB.net Win apps, and I'm reading a section on events and delegates and raising events. Is it just me, or is this not just subs dressed up as something else? I...
14
by: xoozlez | last post by:
Hi there, I have a registration form where I like to filter out the past events of 2007. This is the code I am using : strSQL = "SELECT EventID, EventName, EventDateBegin, EventDateEnd,...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.