如何滚动数据表中的行 [英] How to scroll through rows in datatable

查看:72
本文介绍了如何滚动数据表中的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我碰巧有一个员工裁判桌,在其中我需要能够滚动浏览各行并在控件(例如标签)中显示每行的值.问题是我的解决方案只显示两个裁判,而不是三个裁判,但每个员工都有三个裁判.这是我的代码.

Hi guys! I happen to have an employee referee''s table where i need to be able to scroll through the rows and display each row value in a control e.g labels. The problem is my solution shows only two referees instead of three yet each employee has three referees. Here is my code.

for(int rowindex=0; rowindex.

最后,我该如何告诉我在最后一行,并要求用户像上一行一样返回.

Finally how do i tell that am at last row and ask user to go back as in previous row.

推荐答案

您应该尝试这样的foreach循环:

You should try a foreach loop like this:

DataTable dt = new DataTable();
            foreach (DataRow dr in dt.Rows)
            {
                //Process row
            }



这样一来,您不必检查自己是否在最后一行,也就可以使用强类型的DataRow.

希望对您有帮助



That way you never have to check whether you are on the last row or not, also you have a strongly typed DataRow to work with.

Hope this helps


这篇关于如何滚动数据表中的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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