txt 文件如何打开
如何用程序打开txt 文件
程序代码:
Public Class Form1 Dim File As String Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Dim FileNum As Integer Dim TempString As String, Temp As String TempString = "" : Temp = "" FileNum = FreeFile() If File <> "" Then FileOpen(FileNum, File, OpenMode.Input, OpenAccess.Default, OpenShare.Default) Do While Not EOF(FileNum) Temp = LineInput(FileNum) TempString = TempString & Temp & vbCrLf Loop FileClose(FileNum) TextBox2.Text = TempString End If End Sub Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown Dim FileName As String Dialog1.FileName = "" Dialog1.Filter = "文字档(*. TXT)|*. TXT|所有档案 (*.*)|*.*" Dialog1.Title = "Select a TXT File" Dialog1.ShowDialog() FileName = Dialog1.FileName If FileName <> "" Then File = FileName TextBox1.Text = FileName End If FileName = "" : TextBox2.Text = "" End Sub End Class
这是可以用~只是我顺便想问~怎么开好慢~是因为和VB6的写法不同吗?
还有~
Button1_MouseDown和Button1_Click有什么差别?Button1_Click不能用说~
[ 本帖最后由 wube 于 2011-7-24 12:12 编辑 ]