J
Justin Hoffman
I am new to vb.net programming and am just exploring the way databinding
works with Windows forms and am having trouble with some fairly basic
customization of data entry. The form uses the SqlDataAdapter and
SqlDataset and loads a very simple table, with both text and integer fields.
If a textbox is bound to an integer source where the current value is a
valid integer, say 9, I can type in the textbox 'rubbish' and move to
another textbox. No error is generated, the textbox simply reverts to its
previous value of 9.
What I would like to happen, is that an error message is shown to the user
saying a number is expected. Clicking OK returns the cursor to the
textbox - still with the value of 'rubbish' in it so he can see the rubbish
he has typed. I would hope this is not a wildly unusual customization to
make, however I cannot make it happen.
I have tried code in the Binding.Parse event and Textbox.Validating event,
and both places allow me to catch the error, but not return focus to the
textbox with the offending value showing. I have had a good search through
the archives and seen similar posts, but no solution. Does anyone here know
one?
Thank you for any suggestions
works with Windows forms and am having trouble with some fairly basic
customization of data entry. The form uses the SqlDataAdapter and
SqlDataset and loads a very simple table, with both text and integer fields.
If a textbox is bound to an integer source where the current value is a
valid integer, say 9, I can type in the textbox 'rubbish' and move to
another textbox. No error is generated, the textbox simply reverts to its
previous value of 9.
What I would like to happen, is that an error message is shown to the user
saying a number is expected. Clicking OK returns the cursor to the
textbox - still with the value of 'rubbish' in it so he can see the rubbish
he has typed. I would hope this is not a wildly unusual customization to
make, however I cannot make it happen.
I have tried code in the Binding.Parse event and Textbox.Validating event,
and both places allow me to catch the error, but not return focus to the
textbox with the offending value showing. I have had a good search through
the archives and seen similar posts, but no solution. Does anyone here know
one?
Thank you for any suggestions