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

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 "TextChanged" 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 1665

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***********@iinet.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
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...
5
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...
3
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...
17
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...
8
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...
4
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...
4
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...
4
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)...
3
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...
11
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"...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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...

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.