|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Cause Checkbox to lose focusIf 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 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: Show quoteHide quote > 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 > > 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 Show quoteHide quote "R. MacDonald" <sci***@NO-SP-AMcips.ca> wrote in message news:441bba29$0$40635$dbd4b001@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 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: Show quoteHide quote > 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 > "OpticTygre" <opticty***@adelphia.net> schrieb Addhandler NewCheckbox.checkedchanged, addressof OncheckedChanged> 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? '... private sub OnCheckedChanged (ByVal sender As Object, ByVal e As System.EventArgs) '... end sub Armin
VB utilities??
*@#%! Graphics Case Sensitive Comparison Try Catch Else Finally user control dll missing DllRegisterServer Accessing a Share Using Windows Credentials Any way to disable a column in a DataGrid? MDIParent and MaximizedBounds bug(?) Splitting filenames into parts Problem w/ special characters in a filestream |
|||||||||||||||||||||||