简体   繁体   English

vb.net datagridview和bindingsource

[英]vb.net datagridview and bindingsource

Im in the process over converting some legacy VB6 code over, in particular a TDBGrid linked to an ADODC data control. 我正在转换一些旧式VB6代码,尤其是链接到ADODC数据控件的TDBGrid。

Everything is going ok, ive got my columns and bindignsource reading sweet as a nut and performing what its supposed to do, correctly - but im having a problem converting this type of method over. 一切正常,我让我的专栏和bindignsource像个螺母一样甜美地阅读并正确地执行了它应该做的事情-但是在将这种方法转换过来时遇到问题。

In the vb6 app, while a user scrolls through the grid, the grid fetchstyle (similar to cellformatting) go looking at the equivalent row of data in the adodc. 在vb6应用程序中,当用户滚动浏览网格时,网格获取样式(类似于单元格格式设置)会去查看adodc中的等效数据行。

In .net, I cant seem to get that functionality to be the same, unless I add that field from the database, into a column in the grid and make it invisible (which I dont really want to be doing if i can help it) then read the cell via cellformatting and then perform some action, such as changing the cellstyle backcolor to something. 在.net中,我似乎无法获得相同的功能,除非我将数据库中的该字段添加到网格的一列中并使它不可见(如果我能帮助的话,我真的不想这样做)然后通过单元格格式读取单元格,然后执行一些操作,例如将单元格样式的背景色更改为某种颜色。

Is it possible to refer to a row in the bindingsource that would be the same row in the grid that a user is at, without having that field from the bindingsource - in a DGV column? 是否可以在DGV列中引用绑定源中的行,而该行将与用户所在网格中的行相同,而没有绑定源中的该字段?

or do i just have to put up with placing more columns in the DGV than I want and just live with it? 还是我只需要忍受在DGV中放置比我想要的多的列,然后继续使用它?

Thanks! 谢谢!

我认为您想要BindingSource.Current对象。

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

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