这对于vb.net中的loop语句是什么意思? [英] What is the meaning of this for loop statement in vb.net?

查看:151
本文介绍了这对于vb.net中的loop语句是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

For ctr = 0 To .Tables(0).Rows.Count - 1
               Dim lstview As New ListViewItem



                what is the meaning of this? 
               lstview.Text = .Tables(0).Rows(ctr).Item(0)
               lstview.SubItems.Add(.Tables(0).Rows(ctr).Item(1))

推荐答案

它基本上表示为该表中的每一行做* * *。



不知道它为每一行做了什么,因为唯一的其他代码已被注释掉(因此它不会做任何事情)



并且不显示使用,所以我不知道桌子的来源。



http://www.dotnetperls.com/for-vbnet [ ^ ]







再次 - 如果没有剩下的代码,我无法确定你要做什么。但是你要为表格上的每一行创建一个新的ListViewItem,为它分配一些文本,然后在该表格上添加下一列作为子项目



所以lstview最终会看到这样的东西

Text_From_1st_Column_of_table,Text_from_2nd_column_of_table



但除非你实际将这些添加到ListView控制你不会看到他们。假设您确实将每个lstview放到ListView上,那么最终会得到一个表,该表显示该表中每一行的数据表的前两列。
It essentially says do *something* for every row in that table.

Don't know what it is trying to do for each row as the only other code there is commented out (so it won't do anything)

And the Using isn't displayed so I don't know where the Table came from.

http://www.dotnetperls.com/for-vbnet[^]



Again - without the rest of your code I can't determine what you are trying to do exactly. But you are creating a NEW ListViewItem for each row on your table, assigning some Text to it and then adding the next column on that table as a "sub-item"

So lstview will end up looking something like this
"Text_From_1st_Column_of_table", "Text_from_2nd_column_of_table"

But unless you actually add these to a ListView control you're not going to see them. Assuming you do actually put each lstview onto a ListView then you will end up with a table which displays the first two columns of your data table for every row on that table.


看起来像它循环遍历某种数据库并将代码添加到listview。就像CHill60所提到的那样没有剩下的代码很难说。
It looks like it is looping through some sort of database and adding the code to a listview. Like CHill60 mentioned without the rest of the code its hard to tell.


这篇关于这对于vb.net中的loop语句是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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