小编Omn*_*pus的帖子

在VB.NET中循环遍历文本文件的行

我有一个文本文件,其中包含一些文本行.

我想遍历每一行,直到找到我想要的项目*,然后以标签的形式将其显示在屏幕上.

*我正在通过文本框搜索该项目.

也就是说,在sudo中:

For i = 0 To number of lines in text file
    If txtsearch.text = row(i).text Then
        lbl1.text = row(i).text
Next i
Run Code Online (Sandbox Code Playgroud)

vb.net text loops visual-studio-2008

3
推荐指数
1
解决办法
2万
查看次数

如何将字符串添加到数组VB.NET?

我有一个像这样的数组

Dim array() As String = {}
Run Code Online (Sandbox Code Playgroud)

和以下代码

For i = 0 To membertable.Rows.Count - 1
    If InStr(membertable.Rows(i)("name"), txtSearch.Text, CompareMethod.Text) - 1 _
       <> -1 And txtSearch.Text.Length >= 3 Then

        found = True

        'add the item that matches the criteria to the array here.

    End If
Next i
Run Code Online (Sandbox Code Playgroud)

因此,代码循环遍历访问表的行,并且每次在"name"列下找到与我想要将该项添加到数组的条件匹配的值.数据库项始终是一个字符串.

vb.net arrays

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

vb.net ×2

arrays ×1

loops ×1

text ×1

visual-studio-2008 ×1