3个回答
展开全部
Public Sub ReadTxt(OutTxt As TextBox)
Dim Tmp As String, Temp As String
If Dir(App.Path & "\" & OutTxt.Name & ".txt") <> "" Then
Open App.Path & "\" & OutTxt.Name & ".txt" For Input As #1
Do While Not EOF(1)
Line Input #1, Temp
Tmp = Tmp & Temp & vbCrLf
Loop
Close #1
OutTxt.Text = Tmp
End If
End Sub
Public Sub SaveTxt(strTxt As TextBox)
Open App.Path & "\" & strTxt.Name & ".txt" For Output As #1
Print #1, strTxt.Text
Close #1
End Sub
Private Sub Form_Load()
Call ReadTxt(Form1.Text1) '读取
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call SaveTxt(Form1.Text1) '保存
Call SaveTxt(Form1.Text2)
'多个textbox 就改下参数多次调用即可
End Sub
Dim Tmp As String, Temp As String
If Dir(App.Path & "\" & OutTxt.Name & ".txt") <> "" Then
Open App.Path & "\" & OutTxt.Name & ".txt" For Input As #1
Do While Not EOF(1)
Line Input #1, Temp
Tmp = Tmp & Temp & vbCrLf
Loop
Close #1
OutTxt.Text = Tmp
End If
End Sub
Public Sub SaveTxt(strTxt As TextBox)
Open App.Path & "\" & strTxt.Name & ".txt" For Output As #1
Print #1, strTxt.Text
Close #1
End Sub
Private Sub Form_Load()
Call ReadTxt(Form1.Text1) '读取
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call SaveTxt(Form1.Text1) '保存
Call SaveTxt(Form1.Text2)
'多个textbox 就改下参数多次调用即可
End Sub
更多追问追答
追问
读取时怎样将读取的付内容给对应的text
追答
Call ReadTxt(Form1.Text1) '读取
Call ReadTxt(Form1.Text2) '
展开全部
你说的另一个窗口中是不是这个程序中的?如果是的话可以用<窗口名>.print <要显示的内容。或者其他输出方式只要是在前边加 "另一个窗口名."。
追问
给个具体实例吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
楼上的代码应该不行吧...你这样只能写入一个TEXT控件吧...如果要实现多个TEXT控件内容的读写...最好是写入INI文件...
楼主加我为百度好友...我再告诉你QQ..我给你做个实例...
楼主加我为百度好友...我再告诉你QQ..我给你做个实例...
追问
怎样加你!
追答
点我的名字...然后点加为好友啊...哎...
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询