之前有童鞋帮我写了这个程序,可是运行之后text中显示的本文总是不正确
我的文本中有空格,有回车,可是运行完之后要么只有第一行的数,要么在第一个空格之后的就都没显示,这是怎么回事呢?
应该怎么修改呢?
Private Sub Command1_Click()
Dim strFileName As String
Dim intFileNo As Integer
Dim strInput As String
On Error GoTo errSub
With CommonDialog1
.FileName = ""
.DialogTitle = "打开文件"
.Filter = "文本文件|*.txt"
.InitDir = App.Path
End With
CommonDialog1.ShowOpen '显示对话框,选择要打开的文件
strFileName = CommonDialog1.FileName '录入要打开的文件路径
If strFileName <> "" Then
'执行打开文件操作
intFileNo = FreeFile(0)
Open strFileName For Input As #intFileNo
Input #intFileNo, strInput
Close #intFileNo
Text1.Text = strInput
End If
Exit Sub
errSub:End Sub
我的文本中有空格,有回车,可是运行完之后要么只有第一行的数,要么在第一个空格之后的就都没显示,这是怎么回事呢?
应该怎么修改呢?
Private Sub Command1_Click()
Dim strFileName As String
Dim intFileNo As Integer
Dim strInput As String
On Error GoTo errSub
With CommonDialog1
.FileName = ""
.DialogTitle = "打开文件"
.Filter = "文本文件|*.txt"
.InitDir = App.Path
End With
CommonDialog1.ShowOpen '显示对话框,选择要打开的文件
strFileName = CommonDialog1.FileName '录入要打开的文件路径
If strFileName <> "" Then
'执行打开文件操作
intFileNo = FreeFile(0)
Open strFileName For Input As #intFileNo
Input #intFileNo, strInput
Close #intFileNo
Text1.Text = strInput
End If
Exit Sub
errSub:End Sub
Text1.MultiLine = True
Dim strFileName As String
Dim intFileNo As Integer
Dim strInput As String
On Error GoTo errSub
With CommonDialog1
.FileName = ""
.DialogTitle = "打开文件"
.Filter = "文本文件|*.txt"
.InitDir = App.Path
End With
CommonDialog1.ShowOpen '显示对话框,选择要打开的文件
strFileName = CommonDialog1.FileName '录入要打开的文件路径
If strFileName <> "" Then
'执行打开文件操作
intFileNo = FreeFile(0)
Open strFileName For Input As #intFileNo
Input #intFileNo, strInput
Text1.Text = strInput
do while not eof(#intFileNo)
Input #intFileNo, strInput
Text1.Text = Text1.Text & vbcrlf & strInput
loop
Close #intFileNo
End If
Exit Sub
errSub:End Sub
Private Sub Command1_Click()
Dim strFileName As String
Dim intFileNo As Integer
Dim strInput As String
On Error GoTo errSub
With CommonDialog1
.FileName = ""
.DialogTitle = "打开文件"
.Filter = "文本文件|*.txt"
.InitDir = App.Path
End With
CommonDialog1.ShowOpen '显示对话框,选择要打开的文件
strFileName = CommonDialog1.FileName '录入要打开的文件路径
If strFileName <> "" Then
'执行打开文件操作
intFileNo = FreeFile(0)
text1.text=""
Open strFileName For Input As #intFileNo
do while not eof(intFileNo)
Input #intFileNo, strInput
Text1.Text = Text1.Text & strInput & vbcrlf
loop
Close #intFileNo
End If
Exit Sub
errSub:End Sub
create mytable(myfield m)
cfilename=getfile("txt",'打开文件')
if not empty(cfilename)
use mytable
append meno myfield from (cfilename) overwrite
thisfrom.edttext.controlsource='mytable.myfield'
thisfrom.refresh
endif