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

How to dynamically enable a control and refresh it into the taborder

kea
I have a checkbox and a textbox in a continuous taborder on a form
along with a bunch of other controls. The textbox is disabled.

When I leave the checkbox I want to enable the textbox and move the
focus to it (only if the checkbox.checked=true).

So on the checkbox Leave-event i do the following:
if checkbox.checked=true then
textbox.enabled = true
end if

The result:
the textbox is enabled but the focus is moved to the control after the
textbox.

Question:
Why does the focus not go to the textbox as the textbox is enabled? How
do I get the wanted effect?

I know I can use textbox.focus(), but that gives me problems if the
checkbox is checked and another control subsequent is activated by a
mouseclick. Then the focus will go to the textbox instead of the
control activated by the mouse.

Sep 30 '05 #1
2 2223
DWS
kea,
In the old days I would use the checkchanged event. Here's an example.

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles CheckBox1.CheckedChanged
TextBox1.Enabled = CheckBox1.Checked
End Sub

Good Luck
DWS
"kea" wrote:
I have a checkbox and a textbox in a continuous taborder on a form
along with a bunch of other controls. The textbox is disabled.

When I leave the checkbox I want to enable the textbox and move the
focus to it (only if the checkbox.checked=true).

So on the checkbox Leave-event i do the following:
if checkbox.checked=true then
textbox.enabled = true
end if

The result:
the textbox is enabled but the focus is moved to the control after the
textbox.

Question:
Why does the focus not go to the textbox as the textbox is enabled? How
do I get the wanted effect?

I know I can use textbox.focus(), but that gives me problems if the
checkbox is checked and another control subsequent is activated by a
mouseclick. Then the focus will go to the textbox instead of the
control activated by the mouse.

Sep 30 '05 #2
kea
I tried to simplify my problem but that backfired!

My problem is that I have a groupbox of radiobuttons and each
radiobutton enables/disables/resets some controls. But I do NOT want
this to happen on the specific radiobutton CheckedChanged-event, but
first when I leave the groupbox. Otherwise I get the sitiation that
when I move through the radiobuttons with presses on the arrow key, the
checkChanged event gets fired for each radiobutton I passes. Thereby I
might reset some controls that already contains data and sholud not be
reset..

I want to find out which radiobutton is checked when I leave the
groupBox and then make the enables/disables/resets of the controls. But
if the next control in the taborder is disabled when I enter my
groupbox of radiobuttons, and I enable it in the leave-event of the
groupbox, it does not give focus to the control I just enabled! WHY
NOT???

DWS skrev:
kea,
In the old days I would use the checkchanged event. Here's an example.

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles CheckBox1.CheckedChanged
TextBox1.Enabled = CheckBox1.Checked
End Sub

Good Luck
DWS
"kea" wrote:
I have a checkbox and a textbox in a continuous taborder on a form
along with a bunch of other controls. The textbox is disabled.

When I leave the checkbox I want to enable the textbox and move the
focus to it (only if the checkbox.checked=true).

So on the checkbox Leave-event i do the following:
if checkbox.checked=true then
textbox.enabled = true
end if

The result:
the textbox is enabled but the focus is moved to the control after the
textbox.

Question:
Why does the focus not go to the textbox as the textbox is enabled? How
do I get the wanted effect?

I know I can use textbox.focus(), but that gives me problems if the
checkbox is checked and another control subsequent is activated by a
mouseclick. Then the focus will go to the textbox instead of the
control activated by the mouse.


Oct 2 '05 #3

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

Similar topics

0
by: Josema | last post by:
Hi to all, I have a webform.aspx and inside i have a dropdown list with autopostback and a place holder... Depending of the selected index that the user selects in the dropdownlist i load a...
2
by: DesignerX | last post by:
I have a user control that contains a custom control, both are loaded dynamically. The custom control has a simple required field validator and a text box to validate. When the submit button...
0
by: John Crowley | last post by:
I'm having an odd problem with viewstate and a dynamically created control inside a repeater template. Basically, I have a repeater setup like this in the aspx:
2
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
5
by: kw | last post by:
My aspx dynamically loads an ascx into a placeholder. The ascx has an event. When I click on the submit linkbutton in the ascx, the event does not fire. But if I click it a second time, it...
9
by: TCORDON | last post by:
I have a user control that contains 2 image buttons, when you click one of them, both must change the image source, the thing is that the first time you click any one of them the page appears to do...
2
by: kea | last post by:
I have a checkbox and a textbox in a continuous taborder on a form along with a bunch of other controls. The textbox is disabled. When I leave the checkbox I want to enable the textbox and move...
5
by: misiek | last post by:
Hi all. I would like to know if it is possible to dynamically enable/disable row editing in GridView control in ASP.NET 2.0. I am asking because this feature should be enabled/disable depending...
2
by: active | last post by:
Refresh says: -Forces the control to invalidate its client area and immediately redraw itself and any child controls. Not the Menu for example? While Invalidate() says: -Invalidates the entire...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
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,...
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...

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.