473,385 Members | 1,615 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,385 software developers and data experts.

Leave event in a Usercontrol

Hi,
I have an array of usercontrols, each of the usercontrol has a label
and a textbox, I want to do some checking when the textbox loses
focus, the code is like this:

Private Sub txtTextBox_Leave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtTextBox.Leave

select case me.tabindex
case 3...
case 5...

but this event won't fire, while "txtTextBox_KeyPress" is working
without problem.
I figured out that I can use the usercontrol's own 'leave' event,
because the label's TabStop is set to false and the textbox's TabStop
is true, so leaving the textbox means leaving the usercontrol, but the
usercontrol is in a control array, the IDE says I cannot use
'withevents' on control array, but this is not a good solution anyway,
I'm trying to do the checking inside the usercontrol.
Thanks for any ideas.

Nov 20 '05 #1
4 4542
Liups,

can't you simple override OnLeave of your UserControl? That should do it,
since it's inherited from UserControl?

Klaus

"liups" <Ge*****@Spammers.com> schrieb im Newsbeitrag
news:0e********************************@4ax.com...
Hi,
I have an array of usercontrols, each of the usercontrol has a label
and a textbox, I want to do some checking when the textbox loses
focus, the code is like this:

Private Sub txtTextBox_Leave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtTextBox.Leave

select case me.tabindex
case 3...
case 5...

but this event won't fire, while "txtTextBox_KeyPress" is working
without problem.
I figured out that I can use the usercontrol's own 'leave' event,
because the label's TabStop is set to false and the textbox's TabStop
is true, so leaving the textbox means leaving the usercontrol, but the
usercontrol is in a control array, the IDE says I cannot use
'withevents' on control array, but this is not a good solution anyway,
I'm trying to do the checking inside the usercontrol.
Thanks for any ideas.

Nov 20 '05 #2
Thank you very much, Klaus

On Fri, 30 Jan 2004 13:36:44 +0100, "Klaus Löffelmann"
<fo***********@loeffelmann.de> wrote:
Liups,

can't you simple override OnLeave of your UserControl? That should do it,
since it's inherited from UserControl?

Klaus


Nov 20 '05 #3
"liups" <Ge*****@Spammers.com> schrieb
Hi,
I have an array of usercontrols, each of the usercontrol has a
label and a textbox, I want to do some checking when the textbox
loses focus, the code is like this:

Private Sub txtTextBox_Leave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles txtTextBox.Leave

select case me.tabindex
case 3...
case 5...

but this event won't fire, while "txtTextBox_KeyPress" is working
without problem.
I figured out that I can use the usercontrol's own 'leave' event,
because the label's TabStop is set to false and the textbox's
TabStop is true, so leaving the textbox means leaving the
usercontrol, but the usercontrol is in a control array, the IDE says
I cannot use 'withevents' on control array, but this is not a good
solution anyway, I'm trying to do the checking inside the
usercontrol. Thanks for any ideas.


The leave event fires whenever you jump to another control in the *same*
usercontrol. Enter/Leave events are related to the same containercontrol.
Use Lostfocus instead.

Concerning the array: Have a look at the Addhandler statement.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
Cor
Hi Armin,

I have told OT in the in the dotnet general group that you are good in
things as the object browser (I hope that I am not wrong) and that it could
be wise to ask his question in this newsgroup.

(About what he write , that is not from me)

Cor
Nov 20 '05 #5

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

Similar topics

1
by: jralford | last post by:
Hi, Another question from a C# newbie: I have a usercontrol class that includes a customized control. Now, if I create an instance of the class, and click on it, a click event is raised for the...
2
by: Tim_Mac | last post by:
hi, i have an aspx page which dynamically loads a user control and adds it to a placeholder. the control is recreated and added to the placeholder for postbacks as well. the user control...
1
by: Lin | last post by:
Hi All, I have a UserControl and in the UserControl I have a few controls (textbox buttons ect.) and I want to know how can I fire the "onchange" event (of the usercontrol) when the textbox in...
0
by: Gary Shell | last post by:
I am experiencing some strange behavior between a UserControl's validating event and a treeview control. Initially, I thought it was related to an issue in the Knowledgebase article 810852...
41
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based...
2
by: Simon Verona | last post by:
I have a usercontrol with code in the "leave" event which updates the final data back into a database. This works fine except if I have a default "accept" button on a form and invoke it by...
9
by: Marcelo Cabrera | last post by:
Hi, I have a user control that in turn creates a bunch of webcontrols dynamically and handles the events these webcontrols raise. It used to work fine on ASP .Net 1.1 but when compiled on 2.0 it...
5
by: seal | last post by:
OK, I am trying to fire an event from a usercontrol that tells the page when a checkbox was clicked. Here is the control and when I try and wire up the page to catch the event, my event is not...
2
by: Franky | last post by:
Threre is a Form containing a usercontrol In the form's Load event it references a usercontrol property, say, zz The first showdialog(formx) causes 1 usercontrol_load event 2 form_load event...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.