473,847 Members | 1,499 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Focus-Lost Problem

Hello

againe a "basic" question on UserControls.

I have some UserControls inside a panel.
Inside the controls i have checkboxes, comboboxes and textboxes.
On change of any data inside the control i like to save the actual done
change.
I can do this on the checkboxes or combos, by using the events provided
by the controls.
For the textbox this is a little more tricky (as it seems to me)

I don't want to use the "TextChange d" event, as this one is called on
every keypress. As i'm saving the chages to DB this would be... lets
say absurd.
I do save the changes on the "Leave" event therefore.

My problem comes if i close the parentwindow, where the pannel and
controls are embedded, prior of changeing the focus of the textbox
previously.
Any changes to the textbox are lost then.

I don't want so save the data in the destructor, as i can't rely on it
to be called before eg. the data is displayed againe (and of course the
wrong data if GC would not have deleted the object yet).

I also don't like to implement some "Save" function in the control that
i call on Unloading of the parent window for every UserControl inside
the panel (even though i will have to do this ...).

Can anyone give some hints?

_thanks in advance

Nov 27 '06 #1
3 1683

hula schrieb:
Hello

againe a "basic" question on UserControls.

I have some UserControls inside a panel.
Inside the controls i have checkboxes, comboboxes and textboxes.
On change of any data inside the control i like to save the actual done
....
>
I also don't like to implement some "Save" function in the control that
i call on Unloading of the parent window for every UserControl inside
the panel (even though i will have to do this ...).

Can anyone give some hints?

_thanks in advance
Ups: forgot to mention:
At the moment i solved the problem by setting the focus to some button
in the parentform, to force a "Leave" event in the usercontrol. But i
think this is not the way to do it right?

Nov 27 '06 #2
Can you not use the FormClosing event? This event fires when a request
has been made to close the form but it hasnt actually closed yet

You wont know if the text box has changed but you can force a check to
occur

On Nov 28, 9:57 am, "hula" <b...@n-wt.comwrote:
hula schrieb:


Hello
againe a "basic" question on UserControls.
I have some UserControls inside a panel.
Inside the controls i have checkboxes, comboboxes and textboxes.
On change of any data inside the control i like to save the actual done
...
I also don't like to implement some "Save" function in the control that
i call on Unloading of the parent window for every UserControl inside
the panel (even though i will have to do this ...).
Can anyone give some hints?
_thanks in advanceUps: forgot to mention:
At the moment i solved the problem by setting the focus to some button
in the parentform, to force a "Leave" event in the usercontrol. But i
think this is not the way to do it right?
Nov 28 '06 #3

ni***********@i inet.net.au schrieb:
Can you not use the FormClosing event? This event fires when a request
has been made to close the form but it hasnt actually closed yet

You wont know if the text box has changed but you can force a check to
occur

On Nov 28, 9:57 am, "hula" <b...@n-wt.comwrote:
hula schrieb:
This event is not present on UserControls

Nov 28 '06 #4

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

Similar topics

2
4229
by: Fred Snider | last post by:
Help! Opening a new window using the window.open( ) command works great for opening new windows and having them on top and having the focus. The window.focus command brings any existing windows to the front (top) in Netscape, IE and Opera. However, this command does nothing when you access the web page through AOL, even though they say this is IE. Once a window is behind (blurred), I have been unable to bring it back to the front...
5
11384
by: tshad | last post by:
I have a date validation function that I want to stay at the object I am validating if there is a Validation error, but it always goes to the next object. The Javascript: function ValidateForm(me){ var dt=me if (isDate(dt.value)==false){ dt.focus()
3
6902
by: VA | last post by:
t=document.getElementById('mytable') is a HTML table with some input fields in its cells Why doesnt t.getElementsByTagName('tr').firstChild.focus; put the focus on that text field? It doesnt give any errors, the focus just doesnt change.
17
3873
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a record to the subform (based on the value of the combo box) and requeries the subform control. I want the focus to return to the combo box on the main form when it's done, but I can't get it to do so if the user enters a value and presses Enter...
8
2011
by: copyco | last post by:
I want to be able to test if my app's form has focus, (ie: not in background, behind other windows). How can I do this? I tried the Me.Focused, but that doesn't work. I think it's because a control within the form actually has focus, so the Me.Focused would return false. Thanks!
4
13454
by: planb | last post by:
Hi, I'd like to have a rollover like effect when a input field has the focus, any idea of how to do this with just CSS (easy enough with javascript)? What I'm thinking of is having a tips box show up next to the input field, but only when the field actually has focus. I was thinking if there's any way to make the focus apply to a
4
68057
by: Roger | last post by:
Hi, I am confused about the differences between this.window.focus(), window.focus(), and this.focus(). I want to use the calls in a <body onload="..."tag. What are the differences between these forms that may make one succeed and another fail? In particular, this.window.focus() fails in Opera 9.10 with an "object not found", and windows.focus() succeeds in Opera 9.10, Firefox 2.02, and IE 7.
4
2457
by: Jeff | last post by:
Hi, I'm attaching an onfocus event handler to an anchor tag like this: if(window.attachEvent) anchor_node.attachEvent('onfocus', gotFocus); if(window.addEventListener) anchor_node.addEventListener('focus', gotFocus, false); function gotFocus() { alert('i got focus');
3
5203
by: jp2express | last post by:
I have several applications that use panels as screens, but I can *not* seem to set the focus for a Textbox. Panel1.BringToFront() Panel1_Textbox.Focus() ' do something with a control on Panel1 Panel2.BringToFront() Panel2_Textbox.Focus() ' do something with a control on Panel2
11
3935
by: slinky | last post by:
I'm trying to simply set the focus of "txtUserName" upon opening this login form. I put in some Javascript but it is not working. Any ideas? Thanks! <%@ Page Language="vb" AutoEventWireup="false" Codebehind="Login.aspx.vb" Inherits="Forsyth.HR_ReportingTool.UI.Login" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD>
0
9734
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
10995
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10654
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...
0
10347
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
7888
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
7061
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
5729
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...
1
4540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3168
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.