本文介绍了如何在VB.NET中搜索文本文件以显示特定字符​​串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我需要搜索一个带有8位整数的文本文件,找到一个包含8位整数的整行。

我试过使用streamreader虽然无法得到我想要的结果。

任何帮助都将不胜感激。



我尝试过的:



明确选项

进口system.io

昏暗搜索为StreamReader

Dim filename,textline As String,数量,价格,gtin8 As Integer

filename =(newname.txt)

gtin8 = TextBox1.Text

search = New StreamReader(filename)

如果search.contains(gtin8)那么

ListBox1.Items.Add(textstring)

解决方案

Hello,
I need to search a text file with an eight digit integer, to find a whole line which the eight digit integer is contained in.
I tried using streamreader though couldn't get the results I wanted.
Any help would be greatly appreciated.

What I have tried:

option explicit on
imports system.io
Dim search As StreamReader
Dim filename, textline As String, quantity, price, gtin8 As Integer
filename = ("newname.txt")
gtin8 = TextBox1.Text
search = New StreamReader(filename)
If search.contains(gtin8) Then
ListBox1.Items.Add(textstring)

解决方案


这篇关于如何在VB.NET中搜索文本文件以显示特定字符​​串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 09:03