VB 通用中加表达式报错
在以下这段代码中一个 form1 为什么我在通用中这样定义 如下
Dim a As Integer '声明一个全局共用的整形变量
a = 1 '为A赋值为1 我想问下为什么会报错?不能在通用中用表达式?为什么呢
Private Function abc()
Dim a As Integer
abc = 100
End Function
Sub Command1_Click()
Dim a As Integer
a = 1
MsgBox a
End Sub
Sub Command2_Click()
MsgBox a
End Sub
Private Sub Command3_Click()
a = 100
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error Resume Next
Dir1.Path = Drive1.Drive
If Err.Number > 0 Then
MsgBox "打开设备错误", vbCritical
End If
End Sub
Private Sub File1_Click()
Dim filename1 As String
Dim filenum As Long
Dim filestr As String
If Right(File1.Path, 1) = "\" Then
filename1 = File1.Path & File1.filename
Else
filename1 = File1.Path & "\" & File1.filename
End If
filenum = FreeFile()
Open filename1 For Input As #filenum
Input #filenum, filestr
Close #filenum
Text1.Text = filestr
End Sub
Private Sub Form_Load()
File1.Pattern = "*.txt"
End Sub
Private Sub Text1_Change()
Dim filename1 As String
Dim filenum As Long