473,403 Members | 2,354 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,403 software developers and data experts.

How many times does a control trigger a "MODIFIEDCHANGED" event???

Ok, I'm pretty new to VB.Net, so please bear with me. Imagine the
Load event of one of my forms includes the following:

Dim ctrl as Control
Dim txtbox As TextBox

For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then
txtbox = CType(ctrl, TextBox)
AddHandler txtbox.ModifiedChanged, AddressOf TextBoxChanged
End If
Next
....now here is what my "TextBoxChanged" routine looks like:

Private Sub TextBoxChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs)
MessageBox.Show("Hello World")
End Sub
....Now imagine my form has (amongst other controls) two textboxes on
it (Textbox1 and Textbox2). Here's what I'm finding:

After the form loads, if I type into Textbox1, I will successfully
trigger the "TextBoxChanged" routine.

But.... If I then give some other control on the form the Focus, then
return to Textbox1 and start typing again... this action will NOT
trigger "TextBoxChanged" again.

The same is true of Textbox2. The FIRST time I type into it, I will
trigger "TextBoxChanged", but at no other time during that instance of
my Form will I be able to trigger "TextBoxChanged" again.

I don't know whether I've explained this well, but can somebody take a
stab at telling me what might be going on here? Does a Textbox only
trigger ONE 'ModifiedChanged' event per instance of its containing
form?

Thanks in advance.
Apr 15 '07 #1
2 3549
Sorry, I mistakingly posted this to the 'dotnet.xml' group. I don't
know how to delete these messages, but I do apologize.

On Sun, 15 Apr 2007 20:44:32 GMT, Alan Mailer
<cl**********@earthlink.netwrote:
>Ok, I'm pretty new to VB.Net, so please bear with me. Imagine the
Load event of one of my forms includes the following:

Dim ctrl as Control
Dim txtbox As TextBox

For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then
txtbox = CType(ctrl, TextBox)
AddHandler txtbox.ModifiedChanged, AddressOf TextBoxChanged
End If
Next
...now here is what my "TextBoxChanged" routine looks like:

Private Sub TextBoxChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs)
MessageBox.Show("Hello World")
End Sub
...Now imagine my form has (amongst other controls) two textboxes on
it (Textbox1 and Textbox2). Here's what I'm finding:

After the form loads, if I type into Textbox1, I will successfully
trigger the "TextBoxChanged" routine.

But.... If I then give some other control on the form the Focus, then
return to Textbox1 and start typing again... this action will NOT
trigger "TextBoxChanged" again.

The same is true of Textbox2. The FIRST time I type into it, I will
trigger "TextBoxChanged", but at no other time during that instance of
my Form will I be able to trigger "TextBoxChanged" again.

I don't know whether I've explained this well, but can somebody take a
stab at telling me what might be going on here? Does a Textbox only
trigger ONE 'ModifiedChanged' event per instance of its containing
form?

Thanks in advance.
Apr 15 '07 #2
Alan Mailer wrote:
Ok, I'm pretty new to VB.Net, so please bear with me. Imagine the
Load event of one of my forms includes the following:

Dim ctrl as Control
Dim txtbox As TextBox

For Each ctrl In Me.Controls
If TypeOf ctrl Is TextBox Then
txtbox = CType(ctrl, TextBox)
AddHandler txtbox.ModifiedChanged, AddressOf TextBoxChanged
End If
Next
...now here is what my "TextBoxChanged" routine looks like:

Private Sub TextBoxChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs)
MessageBox.Show("Hello World")
End Sub
This newsgroup is about XML in the .NET framework, I don't see how that
code deals in any way with XML. If your form is an ASP.NET form then try
an ASP.NET group, otherwise a WinForms group or VB.NET group.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
Apr 16 '07 #3

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

Similar topics

1
by: Alan Mailer | last post by:
Ok, I'm pretty new to VB.Net, so please bear with me. Imagine the Load event of one of my forms includes the following: Dim ctrl as Control Dim txtbox As TextBox For Each ctrl In Me.Controls...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.