VB复选框问题 vb复选框问题
VB\u4e2d\u590d\u9009\u6846\u7684\u95ee\u9898Private Sub Check1_Click() '\u7c97\u4f53\u590d\u9009\u6846 \u5982\u679c\u662ftext\u63a7\u4ef6\u65f6\uff0c\u628alabel1\u6539\u6389
If Check1.Value = 0 Then '\u5047\u5982check\u7684\u503c\u4e3a0(flase),\u5373\u6ca1\u6709\u9009\u4e2d\u65f6\uff0c\u5219
Label1.FontBold = Flase 'label1 \u7c97\u4f53\u5c5e\u6027\u4e3aflase
Else '\u5426\u5219 ,\u5373True\u9009\u4e2d\u72b6\u6001
Label1.FontBold = True 'label1 \u7c97\u4f53\u5c5e\u6027\u4e5f\u4e3aTrue\uff08\u4e0b\u9762\u7684\u6309\u94ae\u5927\u540c\u5c0f\u5f02\uff09
End If
End Sub
Private Sub Check2_Click() '\u659c\u4f53\u590d\u9009\u6309\u94ae
If Check2.Value = 0 Then
Label1.FontItalic = False
Else
Label1.FontItalic = True
End If
End Sub
Private Sub Check3_Click() '\u4e0b\u5212\u7ebf\u590d\u9009\u6846
If Check3.Value = 0 Then
Label1.FontUnderline = False
Else
Label1.FontUnderline = True
End If
End Sub
dim strResult as stringstrResult="\u6211\u7684\u7231\u597d\u662f"if ch1.value=checked then strResult = strResult & ch1.captionif ch2.value=checked then strResult = strResult & ch1.captionif ch3.value=checked then strResult = strResult & ch1.captionform1.print strResult
Check1.Value = 0这个句子改变了复选框的值,可能会导致复选框发生一次click事件。和鼠标再点了一次是一样的效果。补充:
由于第一次把值改为0了,所以后面Check1.Value = 0 不会改变值,所以不会再次引发的click事件,也就不会死循环。
改成
Private Sub Check1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If 1 = 1 Then
Check1.Value = 0
MsgBox "请在上面的复选框里勾选你处理的数据类型": Exit Sub
End If
End Sub
if 1=1?是什么意思
Private Sub Check1_Click()
If Check1.Value = 1 Then
MsgBox "请在上面的复选框里勾选你处理的数据类型"
Check1.Value = 0
Exit Sub
End If
End Sub
呃。_____
当你点击了一下复选框时,就开始执行1=1这句。这是肯定成立的哈,所以复选框就不能选了,然后执行弹出对话框,跳出过程咯。
就没咯吧,这个题好怪哦。
Check1.Value
=
1
上海
Check2.Value
=
0
广州
Check3.Enabled
=
False
巴黎
(这个更好一些,灰色未选)
或者
Check3.Value
=
2
巴黎
绛旓細濡傛灉浣犲彧鐢ㄤ竴涓澶嶉夋鏉ユ帶鍒跺叏閫夊拰鍏ㄦ竻锛屽彲浠ョ敤妤间笂閭d釜鐨勬柟娉曪紝鍙互鍔犱竴鍙ワ細if check1.value=1 then check1.caption="鍏ㄦ竻"else check1.caption="鍏ㄩ"濡傛灉浣犲垎鍒敤涓や釜澶嶉夋鎺у埗鍏ㄦ竻鍜屽叏閫夛紝浠g爜濡備笅 === 鍏堢敾涓や釜澶嶉夋锛宑heck1涓哄叏閫夛紝澶嶅埗n涓猚heck2锛屼竴鍏卞氨鏈塶+1涓猚heck2锛屽啀鐢讳竴涓...
绛旓細鐢ㄥ惊鐜垽鏂.浣犲缓绔嬬殑3涓澶嶉夋鍜3涓猼ext閮藉缓绔嬫垚鏁扮粍鎺т欢.鎵嶅鏄撳鐞/ Private Sub Check1_Click(Index As Integer) For i = 0 To 2 If Check1(i).Value = 1 Then a = a + 1 If a = 2 Then For x = 0 To 2 If Check1(x).Value <> 1 Then Check1(x...
绛旓細Check1.Value = 1 涓婃捣 Check2.Value = 0 骞垮窞 Check3.Enabled = False 宸撮粠 锛堣繖涓洿濂戒竴浜涳紝鐏拌壊鏈夛級鎴栬 Check3.Value = 2 宸撮粠
绛旓細CheckBoxs涓篢rue 琛ㄧず閫変腑杩澶嶉夋锛屼笉琛ㄧず鏄剧ず浠 鏄剧ず搴旇鐢細浠栫殑visible灞炴ц缃负true
绛旓細Text1.Text = ""If Check1.value = 1 Then Text1.Text = Text1.Text & Check1.Caption & " "If Check2.value = 1 Then Text1.Text = Text1.Text & Check2.Caption & " "If Check3.value = 1 Then Text1.Text = Text1.Text & Check3.Caption & " "If Check4.value = 1 ...
绛旓細鏀规垚锛歀abel1.FontName = IIf(Check1.Value = 1, "榛戜綋", "瀹嬩綋")FontName 鏄瓧浣撳悕绉 鍙︼紝璁剧疆绮椾綋鏃讹細Label1.FontBold = IIf(Check1.Value = 1, True, False)
绛旓細Private Sub Command2_Click() For i = 1 To ListView1.ListItems.Count ListView1.ListItems.Item(i).Checked = False NextEnd SubPrivate Sub Command1_Click() For i = 1 To ListView1.ListItems.Count ListView1.ListItems.Item(i).Checked = True NextEnd SubPrivate S...
绛旓細鍏堣В鍐充綘鐨勯棶棰橈細checkbox鍦ㄨ璁℃椂璁剧疆鍏秜alue灏变笉浼氬紩鍙慶lick浜嬩欢锛屼絾濡傛灉鐢ㄤ唬鐮佺殑璇濆氨浼氬紩鍙慶lick浜嬩欢銆傚彟澶栦綘鐨勭▼搴忔妸绠鍗曠殑闂澶鏉傚寲浜嗭紝涔熻鏄垜鐪嬪緱涓嶄粩缁嗐
绛旓細Private Sub Check1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)Dim i As Integer '閬嶅巻锛屾竻绌洪櫎浜嗙涓涓互澶栨墍鏈塁heck1鐨勯変腑锛堣烦杩囩涓涓负浜嗕繚鐣欑涓涓殑閫変腑灞炴э級For i = 1 To 63 Check1(i).Value = 0 Next Check1(Index).Value = ...
绛旓細涓嶆槸鏈変釜 閫変腑娌¢変腑鐨勫睘鎬у槢 锛 灏辩湅閭d釜 鍒ゆ柇鍟娿傝繖涓睘鎬=TRUE 灏辨槸閫 鍚﹀垯娌℃湁閫夈傜┖闂村悕.灞炴у悕=T OR F 鏉ュ垽鏂傚VB涓嶅お浜嗚В銆 澶ф灏辫繖涓剰鎬濆惂銆 鎳備簡灏辩粰涓垎銆