如何使用绑定源获取上一行 [英] How to get the previous row using a Binding Source

查看:63
本文介绍了如何使用绑定源获取上一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想在我选择的行上显示数据时,如下所示

when i want to display data on my selected row coding like below

Dim barisBulan As bkuDataSet.bulanRow = CType(frmBulan.BulanBindingSource.Current, DataRowView).Row

然后如何显示所选列之前和之后的列?

then how to display the columns before and after of the selected column ?

有人可以帮我吗?

推荐答案

您好Senggel,

Hi Senggel,

我认为您的意思是前后,而不是列...右?

I assume that you mean the before and after Row, not column ... right?

您可以使用BindingSource的.Position属性。由于我不确定您的DataTable名称是什么,我只是想使用任何DataTable。而且,我很抱歉我不太了解VB.NET,但你需要这样的东西:

You could use the .Position property of the BindingSource for that. Since I don't know for sure what your DataTable name is, I'm just going to use any DataTable. And, I'm sorry that I don't know much VB.NET, but you'd need something like this:

Dim dt As DataTable = CType(frmBulan.BulanBindingSource.DataSource, DataTable)
DataRow rowBefore = dt.DefaultView(frmBulan.BulanBindingSource.Position - 1).Row;
DataRow rowAfter = dt.DefaultView(frmBulan.BulanBindingSource.Position + 1).Row;





这篇关于如何使用绑定源获取上一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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