Question Cannot save data

TommyLiu

Member
Joined
Jul 29, 2008
Messages
7
Programming Experience
5-10
Dear all,

I try to use VB .net to develop a small program. In this program, there has a form. In this form, there have several text box and toolbar. The problem is after I input text into textbox and I do not press <enter> key, I go to click save button in form's toolbar. I found that this textbox's data cannot save into database. If I press <enter> key after I input text into textbox, data can save into database properly. What can I solve this problem? Thank you.
 
It is hard to say, not having seen any of your code. In my keypress event I usually use a .PerformClick if my insert statement resides in a button_click event - so I don't have to duplicate code. Or simple use a sub routine and just call that with either event to handle the insert statement. But I would recommend showing us some code so we can really help you with this.
 
Dear all,

Thank you for your reply. For my program screen, please refer to picture as below. I do not write any special code. When I input data in [Leave period], I do not press <Enter> key then click "Save" button [Please refer to red circle in picure]. After, I open database to check that data had been saved or not. The result is [Leave period] field is EMPTY. But I try again that after input data in [Leave period] and then press <Enter> key. Afterwards, click "Save" button. The data had been saved to database successfully. What can I solve this problem? Thank you.


prg_scr.jpg
 
I thought to give you some direction to do some work for yourself ...

anyway: two minutes of searching and clicking (shame on me, I never used bindingsources etc so far) lead me to the idea that:

Dim b As Binding
b.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged

could lead into the right direction.
 
Back
Top