473,804 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Leav e(ByVal sender As Object, ByVal e As
System.EventArg s) Handles txtTextBox.Leav e

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

but this event won't fire, while "txtTextBox_Key Press" 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 4560
Liups,

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

Klaus

"liups" <Ge*****@Spamme rs.com> schrieb im Newsbeitrag
news:0e******** *************** *********@4ax.c om...
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_Leav e(ByVal sender As Object, ByVal e As
System.EventArg s) Handles txtTextBox.Leav e

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

but this event won't fire, while "txtTextBox_Key Press" 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*****@Spamme rs.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_Leav e(ByVal sender As Object, ByVal e As
System.EventArg s) Handles txtTextBox.Leav e

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

but this event won't fire, while "txtTextBox_Key Press" 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 containercontro l.
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
3036
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 customized control within the class. This is good. What I also want is to raise a click event for the class itself. For instance,
2
3452
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 contains a datagrid and some buttons and textboxes. the button events fire correctly and execute their code. however, the datagrid events fire a postback, and execute Page_load in the usercontrol, but the Item_Command code is not executed. the code to...
1
1531
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 the usercontrol is changing. thanks and i hope you anderstood what am i asking.. Lin.
0
2441
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 (http://support.microsoft.com/kb/810852), but then I realized that the hotfix mentioned was in .Net v1.1, which I am using. I took the sample from that article and recreated the situation I see in my application. (Code included below.) If you run the...
41
4336
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 on some initialization information obtained elsewhere. Basically, I'm going to create my own dynamic toolbar where the toolbarbuttons can change. I'm not using the VB toolbar because of limitations in changing things like backcolor (I can't get...
2
5384
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 pressing the ENTER key on the keyboard. In this case, it would appear that whilst the code on the button is executing and therefore presumably the button actually has focus, the leave event in the user control is not fired. Should I be interfacing...
9
14469
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 does not. The problem is that the webcontrols get created on the OnLoad event of the usercontrol and the event handlers are assigned at the same time. I have to click twice on the controls for the events to be raised, the first time nothing...
5
3583
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 shown. What am I doind wrong? public delegate void CheckBoxEventHandler(object sender, System.EventArgs e); public class WebUserControl1 : System.Web.UI.UserControl {
2
2952
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 which causes zz as expected the second showdialog(formx) causes 1 form_load event which causes zz as expected
0
9712
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9594
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10341
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.