留言框与旋钮代码合并后通不过,不知何故?请指正
留言框与按钮代码合并后通不过,不知何故?请指正
本帖最后由 bcrun 于 2012-11-29 15:40:30 编辑 留言框与按钮组独立运行时都可以通过,但合并后就不能通过了,本人不会写代码,请高手帮助改编优化;
错误提示:变量未定义(见粗体字,请问要如何定义,要代码)
Filenum = FreeFile
Open "flag1.dat" For Input As Filenum
cmdflag = Input(1, Filenum)
Close Filenum
If cmdflag Then
Command1.Caption = "是"
Else
Command1.Caption = "否"
End If
合并后全部代码如下:
本帖最后由 bcrun 于 2012-11-29 15:40:30 编辑 留言框与按钮组独立运行时都可以通过,但合并后就不能通过了,本人不会写代码,请高手帮助改编优化;
错误提示:变量未定义(见粗体字,请问要如何定义,要代码)
Filenum = FreeFile
Open "flag1.dat" For Input As Filenum
cmdflag = Input(1, Filenum)
Close Filenum
If cmdflag Then
Command1.Caption = "是"
Else
Command1.Caption = "否"
End If
合并后全部代码如下:
Option Explicit '快手改——1
Private Declare Function GetPrivateProfileInt Lib "kernel32" Alias "GetPrivateProfileIntA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal nDefault As Long, ByVal _
lpFileName As String) As Long
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal _
lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName _
As String) As Long
Dim tags As Integer
Dim FN As String
Dim temp_a As String, temp_b As String, temp_c As String, temp_d As String, temp_e As String, temp_f As String, temp_g As String, temp_h As String, temp_i As String, temp_j As String, temp_k As String
Dim t1 As String, t2 As String, t3 As String, t4 As String, t5 As String, t6 As String, t7 As String, t8 As String, t9 As String, t10 As String, t11 As String
Private Sub Command1_Click() 'hid改——1
If cmdflag Then
Command1.Caption = "否"
cmdflag = 0
Else
Command1.Caption = "是"
cmdflag = 1
End If
Filenum = FreeFile
Open "flag1.dat" For Output As Filenum
Print #Filenum, Format(cmdflag, 0)
Close Filenum
End Sub
Private Sub Command2_Click() 'hid改——2
If cmdflag Then
Command2.Caption = "否"
cmdflag = 0
Else
Command2.Caption = "是"
cmdflag = 1
End If
Filenum = FreeFile
Open "flag2.dat" For Output As Filenum
Print #Filenum, Format(cmdflag, 0)
Close Filenum
End Sub
Private Sub Command3_Click() 'hid改——3
If cmdflag Then
Command3.Caption = "否"
cmdflag = 0
Else
Command3.Caption = "是"
cmdflag = 1
End If
Filenum = FreeFile
Open "flag3.dat" For Output As Filenum
Print #Filenum, Format(cmdflag, 0)
Close Filenum
End Sub
Private Sub Command4_Click() 'hid改——4