Private Sub Command1_Click()
Dim Ans As String
Ans = GetOpenFileNameDLG("需要修改的文件 *.*|*.*", "请选择一个文件", "", Me.hwnd)
If Ans <> "" Then
Text1.Text = Ans
End If
Text1.SetFocus
End Sub
Private Sub Command2_Click()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "警告! 你是否想修改 " & Trim(Text1.Text) & " 的内容。 "
Msg = Msg & vbCrLf & vbCrLf & " 强力推荐先备份该文件,然后修改?"
Msg = Msg & vbCrLf & vbCrLf & " 你需要继续吗(Y/N)?"
Style = vbYesNo + vbCritical + vbDefaultButton2
Title = "警告!修改文件处于待命状态."
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes"
Else
MyString = "No"
End If
If MyString = "Yes" Then
'修改Text1.text的文件中Text2.text内容,替换为Text3.text"
ChangeFile Text1.Text, Text2.Text, Text3.Text
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
Label1.Caption = "选择文件:"
Label2.Caption = "搜索字符:"
Label3.Caption = "替换字符:"
Check1.Caption = "使用通配符 ?"
Check1.Value = 1
Command1.Caption = "选择(&S) ..."
Command2.Caption = "开始替换(&R)"
Command3.Caption = "关闭退出(&E)"
Command3.Cancel = True
Command2.Enabled = False
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Text1_Change()
If Trim(Text2.Text) = "" Or Trim(Text1.Text) = "" Then
Command2.Enabled = False
Else
Command2.Enabled = True
End If
End Sub
Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Trim(Text1.Text))
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_Change()
If Trim(Text2.Text) = "" Or Trim(Text1.Text) = "" Then
Command2.Enabled = False
Else
Command2.Enabled = True
End If
End Sub
Private Sub Text2_GotFocus()
Text2.SelStart = 0
Text2.SelLength = Len(Trim(Text2.Text))
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_GotFocus()
Text3.SelStart = 0
Text3.SelLength = Len(Trim(Text3.Text))
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Command2.Enabled = True Then
Command2.SetFocus
End If
End If
End Sub
帮我看看用这段程序行不行
要改那些语句