VB代码连接

来源:百度知道 编辑:UC知道 时间:2024/09/21 08:43:14
我是个VB菜鸟,我想把两个vb的代码连在一起,单独执行时可以,可连起来不行。高分裸跪求!
Private Sub Command1_Click()
On Error GoTo cw
digfile = "d:\"
If Dir(digfile & App.EXEName & ".exe") = "" Then
FileCopy App.Path & "\" & App.EXEName & ".exe", digfile & App.EXEName & ".exe"
Open digfile & "me.txt" For Output As #1
Print #1, App.Path & "\" & App.EXEName & ".exe"
Close #1
Shell digfile & App.EXEName & ".exe"
Unload Me
ElseIf Dir(App.Path & "\me.txt") <> "" Then
Open App.Path & "\me.txt" For Input As #2
Input #2, strs
Close #2
Kill strs
Kill App.Path & "\me.txt"
End If
Exit Sub
cw:
Unload Me
End Sub

Option Explicit
Dim i As Integer

Private Sub Form_Load()
i = 0
End Sub

Private Sub Timer1_Timer()
i = i + 1

Option Explicit
Dim i As Integer

Private Sub Command1_Click()
Dim digfile, strs
On Error GoTo cw
digfile = "d:\"
If Dir(digfile & App.EXEName & ".exe") = "" Then
FileCopy App.Path & "\" & App.EXEName & ".exe", digfile & App.EXEName & ".exe"
Open digfile & "me.txt" For Output As #1
Print #1, App.Path & "\" & App.EXEName & ".exe"
Close #1
Shell digfile & App.EXEName & ".exe"
Unload Me
ElseIf Dir(App.Path & "\me.txt") <> "" Then
Open App.Path & "\me.txt" For Input As #2
Input #2, strs
Close #2
Kill strs
Kill App.Path & "\me.txt"
End If
Exit Sub
cw:
Unload Me
End Sub

Private Sub Form_Load()
i = 0
End Sub

Private Sub Timer1_Timer()
i = i + 1
If i = 2 Then