Hi,
Is it possible to simply have a control give up the focus (so that the focus moves to the next control in the tab index list). The reason I need to do this is that I've created a UserControl with four text boxs on it and I want the user to be able to type in text box 1 then hit enter and have the focus move to text box 2 and so on until text box 4. SetFocus is fine for text boxs 1, 2, and 3 but when the user hits enter in text box 4 I want the focus to be sent to what ever control is next in line after my UserControl. Being a UserControl, I created it so that I could use it in multiple places, so I don't know "inside" the code for the UserControl which control will be next so I can't call SetFocus on it. Another possibility could be if a UserControl can give up the focus to its containing window but I couldn't find anything on this in the help.
On a related problem is there any way to have SetFocus cause validation. The Validate event is happening if the user Tabs or clicks to change the focus from one text box to another but when I handle the Keypress event and change the focus when vbCr is pressed the Validate event isn't happening! Currently I'm explicitly calling the Validate event sub but that is just a work around that shouldn't be necessary, right?
Cheers,
Ryan.
Is it possible to simply have a control give up the focus (so that the focus moves to the next control in the tab index list). The reason I need to do this is that I've created a UserControl with four text boxs on it and I want the user to be able to type in text box 1 then hit enter and have the focus move to text box 2 and so on until text box 4. SetFocus is fine for text boxs 1, 2, and 3 but when the user hits enter in text box 4 I want the focus to be sent to what ever control is next in line after my UserControl. Being a UserControl, I created it so that I could use it in multiple places, so I don't know "inside" the code for the UserControl which control will be next so I can't call SetFocus on it. Another possibility could be if a UserControl can give up the focus to its containing window but I couldn't find anything on this in the help.
On a related problem is there any way to have SetFocus cause validation. The Validate event is happening if the user Tabs or clicks to change the focus from one text box to another but when I handle the Keypress event and change the focus when vbCr is pressed the Validate event isn't happening! Currently I'm explicitly calling the Validate event sub but that is just a work around that shouldn't be necessary, right?
Cheers,
Ryan.