简体   繁体   English

更新文本框后面的数据表?

[英]Updating the datatable behind a textbox?

Using windows.forms, I have a tabcontrol with a listbox and several textboxes all bound to a datatableadapter. 使用windows.forms,我有一个tabcontrol,其中有一个列表框和几个文本框,它们都绑定到datatableadapter。 When the user selects a member in the listbox the corresponding textboxes are populated. 当用户在列表框中选择成员时,将填充相应的文本框。 The problem is that, when the user edits the text in a textbox it is not being written back to the datatable. 问题是,当用户编辑文本框中的文本时,它没有被写回到数据表中。 So when they select a different member in the listbox their changes are lost. 因此,当他们在列表框中选择其他成员时,其更改将丢失。 I'm trying to handle the textchanged event but cannot find how to update the datatable with the changes. 我正在尝试处理textchanged事件,但是找不到如何使用更改来更新数据表。

I think you should handle the Leave event of the Textbox which is fired when the focus of the textbox is lost. 我认为您应该处理文本框的焦点丢失时触发的文本框的Leave事件。 Then you need to write the the change back to the database. 然后,您需要将更改写回到数据库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM