2,461
社区成员
发帖
与我相关
我的任务
分享
' 以下代码在 VB 6.0 中 IDE下、编译本机代码 exe 测试通过
' 新建标准 EXE 工程
' 添加 Check1, Check2, Check3
' 添加 Command1, Text1
' Set.txt 中的内容:
'Check1=1
'Check2=0
'Check3=2
'Command1=按钮文本
'Text1=运行时改变控件属性!
Option Explicit
Private Sub Command1_Click()
'下面文件路径按你实际情况写
'请保证格式正确
Open "X:\Temp\Set.txt" For Input As #1
Dim strText$, arrParam$()
While (Not EOF(1))
Line Input #1, strText
arrParam = Split(strText, "=")
If (InStr(1, arrParam(0), "Command") = 1) Then
CallByName Controls(arrParam(0)), "Caption", VbLet, arrParam(1)
Else
If (InStr(1, arrParam(0), "Text") = 1) Then
CallByName Controls(arrParam(0)), "Text", VbLet, arrParam(1)
Else
CallByName Controls(arrParam(0)), "Value", VbLet, arrParam(1)
End If
End If
Wend
End Sub