自己编的一个小程序~~部分代码如下: '若用户选择读取文件,则从我的电脑中打开一个文本文档 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click ' Displays an OpenFileDialog so the user can select a word. Dim openFileDialog1 As New OpenFileDialog() openFileDialog1.Filter = "txt文件(*.txt)|*.txt" openFileDialog1.Title = "选择一个文本文件" ' Show the Dialog. ' If the user clicked OK in the dialog and ' a .txt file was selected, open it. If openFileDialog1.ShowDialog() = DialogResult.OK Then TextBox1.Text = ReadFile(openFileDialog1.FileName) & vbCrLf End If '获取文本框的行数 i = System.Text.RegularExpressions.Regex.Matches(TextBox1.Text, "\r\n").Count '用一个数组来接收textbox1各行的信息 Shuzu = New String(i - 1) {} For x As Integer = 0 To i - 1 Shuzu(x) = TextBox1.Lines(x) Next End Sub
- 1
- 粉丝: 0
- 资源: 4
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助