求VB大神帮帮忙,在线等 急急急
内存: 2GB 操作系统:/windos XP/LINUS/ 的代码咋写?? 展开
简洁一点的:
1、5个RadioButton 的 Name 分别是Opt1,Opt2,Opt3,Opt4,Opt5
2、Form中定义5个变量
Dim t1Str, t2Str, t3Str, t4Str, t5Str As String
在Form_Load()中赋初始值
Private Sub Form_Load()
t1Str = ""
t2Str = ""
t3Str = ""
t4Str = ""
t5Str = ""
End Sub
3、在各Opt的Click()事件中分别增加程序:
Private Sub Opt1_Click(Index As Integer)
t1Str = "机型:" & Opt1(Index).Caption + " "
Text1 = t1Str + t2Str + t3Str + t4Str + t5Str
End Sub
Private Sub Opt2_Click(Index As Integer)
t2Str = "CPU:" + Opt2(Index).Caption + " "
Text1 = t1Str + t2Str + t3Str + t4Str + t5Str
End Sub
.....
其它的程序参见附件中的Form5
亲。。能把最后那个操作系统改为复选吗,可以选多个的那种,就把最后语句告我咋改就行
如果要修改为 CheckBox 复选框的话,要调整一下语句.
如:Check1()
Private Sub Check1_Click(Index As Integer)
t1Str = "机型:"
If Check1(0).Value = 1 Then t1Str = t1Str + Check1(0).Caption + " "
If Check1(1).Value = 1 Then t1Str = t1Str + Check1(1).Caption + " "
If Check1(2).Value = 1 Then t1Str = t1Str + Check1(2).Caption + " "
If t1Str = "机型:" Then t1Str = ""
Text1 = t1Str
End Sub
别的 Check_Click() 中的程序自己就照写一下了.....
2024-09-19 广告
你想在什么情况下触发 text框的输出代码呢?
还有最方便的应该是把控件做成控件数组!!!所以依次有
frame1(0~4),option1(0~11),check1(0~2),text1 ' 用checkbox 是因为要复选么?
这里用点击按钮触发代码 所以 加一个 command1
因此有下面这段代码
Private Sub Command1_Click()
Dim temp As String, i As Integer, a As Integer
'frame1(0~3)
For i = 0 To 11
If i Mod 3 = 0 Then
temp = temp & Frame1(a).Caption & ":"
a = a + 1
End If
If Option1(i).Value = True Then
temp = temp & Option1(i).Caption & " "
End If
Next
'frame1(4)
temp = temp & Frame1(4).Caption & ":"
For i = 0 To 2
If Check1(i).Value = 1 Then temp = temp & Check1(i).Caption & " "
Next
Text1.Text = temp
End Sub
发个附件你看一下
好吧附件画少了一个frame,我把 上面的代码修改了一下,附件可以忽略了