单击按钮即可更新vb.net datagrid [英] vb.net datagrid update with button click

查看:90
本文介绍了单击按钮即可更新vb.net datagrid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我将数据网格上的行/列保存或更改之前,必须先将行/列移出,然后再将其提交给数据库.

通常没关系,但是我将文件路径添加到通过openfiledialogue获得的单元格中.关闭openfiledialogue后,在datagrid单元中将显示文件路径dosnt,直到我移出突出显示的单元格为止,这将导致棘手的数据输入.

如何通过单击按钮强制说出要提交的数据或使突出显示的单元格成为下一行.

希望有道理

感谢您的关注

好的,所以要让ppl完全理解问题比实际解决这个问题要困难得多.

因此,我在使用按钮单击和类似代码的思路方面进行了一些思考

私有Sub CmdNext_Click(发送者为System.Object,e为System.EventArgs)处理CmdNext.Click
Me.MyBindingSource.MoveNext()"这将焦点移到了下一个单元格
结束子


网格现在已更新为WORKS.

非常感谢您在这里做出的贡献,希望将来可以帮助您

Before I save or change data in a row/column on my datagrid I have to move off of the row/column before it is submitted to the DB.

Normally this is ok but I''m adding a filepath to a cell which is obtained via openfiledialogue. After I close the openfiledialogue the filepath dosnt show in the datagrid cell until I move off of the highlighted cell, this makes for tricky data entry.

How can I force the data to be submitted say with a button click or make the highlighted cell be the next row.?

Hope that makes sense

thankx for looking

Ok, so it seems it is harder to make ppl understand the problem fully than actualy solve it.

So Im thinking something along the lines of using a button click and code like this

Private Sub CmdNext_Click(sender As System.Object, e As System.EventArgs) Handles CmdNext.Click
Me.MyBindingSource.MoveNext() ''THIS MOVES THE FOCUS TO THE NEXT CELL
End Sub


the grid is now updated it WORKS.

SO THANKS TO YOU WHO MADE A CONTRIBUTION HERE AND I HOPE THIS WILL HELP SOMEONE IN THE FUTURE

推荐答案

对话框返回后,您将数据分配到单元格中,如果可以,则可以使用此说明来结束版本.

datagridview1.Endedit(true)


问候.
after the return of the dialog, you assing the data to the cell, if this is ok, after that, you can use this instruction to end the edition.

datagridview1.Endedit(true)


regards.


这篇关于单击按钮即可更新vb.net datagrid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆