VB中如何将Text1里的内容写到1.TXT文本里第一行的第一的★后面?
VB中如何将Text1里的内容写到1.TXT文本里第一行的第一个★后面?比如说1.TXT文本就一行内容:201309★3 KG★345456★UN★234545645,现在我在VB里的TEXT1里写了10,那么文本1.TXT的内容由原来的“201309★3 KG★345456★UN★234545645”变成“201309★10KG★345456★UN★234545645”?求教了。最近老大要写个小东西,本人新手不会啊。
Private Sub Command1_Click()
Dim buf As String
Open "c:\123.txt" For Input As #1
Line Input #1, buf
Close #1
Dim istart As Integer
Dim iend As Integer
istart = InStr(buf, "★")
iend = InStr(buf, "KG★")
Dim s As String
s = Mid(buf, istart + 1, iend - istart - 1)
buf = Replace(buf, s, Text1.Text, 1, 1, 0)
Open "c:\123.txt" For Output As #1
Print #1, buf
Close #1
End Sub