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

Cause Checkbox to lose focus

If I create a checkbox dynamically:

Dim NewCheckBox as New Checkbox

Then, I display that checkbox on a form, how can I cause the checkbox to
lose focus after a user clicks on it?

TIA,

-Jason
Mar 18 '06 #1
4 4625
Hello, Jason,

Where do you want the focus to go? Just use the Select method on that
control. E.g.

DesiredControlToHaveFocus.Select

Cheers,
Randy
OpticTygre wrote:
If I create a checkbox dynamically:

Dim NewCheckBox as New Checkbox

Then, I display that checkbox on a form, how can I cause the checkbox to
lose focus after a user clicks on it?

TIA,

-Jason

Mar 18 '06 #2
"OpticTygre" <op********@adelphia.net> schrieb
If I create a checkbox dynamically:

Dim NewCheckBox as New Checkbox

Then, I display that checkbox on a form, how can I cause the
checkbox to lose focus after a user clicks on it?


Addhandler NewCheckbox.checkedchanged, addressof OncheckedChanged

'...

private sub OnCheckedChanged (ByVal sender As Object, ByVal e As
System.EventArgs)
'...
end sub
Armin

Mar 18 '06 #3
Haha...I would like the focus to go "anywhere" but on that checkbox. The
problem is, the whole form is dynamically generated. The checkbox's checked
field is bound to an object's boolean variable, and that variable happens to
also be bound to a textbox's enabled property. The problem is, the
databinding doesn't fire if I check or uncheck the checkbox .....UNTIL I
actually click *off* the checkbox into another textbox on the form or
something.

Does that make sense?

-Jason

"R. MacDonald" <sc****@NO-SP-AMcips.ca> wrote in message
news:44***********************@news.wanadoo.nl...
Hello, Jason,

Where do you want the focus to go? Just use the Select method on that
control. E.g.

DesiredControlToHaveFocus.Select

Cheers,
Randy
OpticTygre wrote:
If I create a checkbox dynamically:

Dim NewCheckBox as New Checkbox

Then, I display that checkbox on a form, how can I cause the checkbox to
lose focus after a user clicks on it?

TIA,

-Jason

Mar 18 '06 #4
Hello, Jason,

Yes, I think I understand what you are saying.

What kind of object is it that the CheckBox is bound to? E.g. does it
have an "Update" method that you can use? If it does, you could invoke
that in an event handler (such as the OnCheckedChanged procedure that
Armin is suggesting).

If there is no way to update the bound object directly, you could try
using the CheckBox's SelectNextControl method in the handler to force
the focus to the next control. (But this isn't a very pleasing
solution, because it would introduce a bit of non-standard behaviour in
the user interface. I would recommend trying to find some sort of
"Update" method solution instead.)

Cheers,
Randy
OpticTygre wrote:
Haha...I would like the focus to go "anywhere" but on that checkbox. The
problem is, the whole form is dynamically generated. The checkbox's checked
field is bound to an object's boolean variable, and that variable happens to
also be bound to a textbox's enabled property. The problem is, the
databinding doesn't fire if I check or uncheck the checkbox .....UNTIL I
actually click *off* the checkbox into another textbox on the form or
something.

Does that make sense?

-Jason

Mar 19 '06 #5

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

Similar topics

2
by: Czarina | last post by:
hi guys! here I am again, bugging you Here is where my page stands right now: http://www.gainesvillewebs.com/czar...h_results-2.htm The top 2 forms are working just fine, but the bottom one, with...
1
by: Adi | last post by:
I'm trying to do default focus on checkbox,its work fine but the problem is that the user cannot know where is the focus (there isn't visual sign and on the other hand if you press on the tab...
11
by: Junkguy | last post by:
I need some help programmatically causing a row in a DataGrid to "flush" its contents to its bound data (in Visual Studio 6 using Windows Forms with C#). My issue is I want to send an update to...
2
by: chris | last post by:
Does anybody know how I can programmatically cause a textbox to lose focus and automatically jump to the next appropriate control. I have a custom textbox usercontrol whereby the requirement is...
4
by: SJ | last post by:
Hi all, I have come across a weird problem when attempting to automatically set the focus in a vb.net form to a checkbox control... In my form I have (on a tab page in a tab control) several...
0
by: Stephen Muecke | last post by:
The startup form of my application is used to open other forms containing detail information on projects, organisations, employees etc (similar to Outlook) Each detail form has a print method...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
0
by: TechnoAtif | last post by:
<?php include "dbconnect.php"; include "commonFunc.php"; ?> <!----------------------------------> <table width="80%" border="1" cellpadding="2" cellspacing="0"> <tr > <td...
3
by: Patrick | last post by:
Hi, Newbish on JS here. Found this script on the web and it does what I want in FF, but works oddly in IE. When I check the box in IE nothing happens, but when I click on the body after the box...
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
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
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
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...
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,...
0
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...

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.