Text VB6为什么不使用';你不会变吗?[复选框和文本框]
如果复选框没有勾选,为什么文本框中的文本不会更改?如果未选中,则文本框的文本应具有“-g no”,但在单击Command1时不会更改。有什么解决办法吗?可能是一件很简单的事情,但我就是没有成功\ 我的代码:Text VB6为什么不使用';你不会变吗?[复选框和文本框],text,checkbox,vb6,textbox,Text,Checkbox,Vb6,Textbox,如果复选框没有勾选,为什么文本框中的文本不会更改?如果未选中,则文本框的文本应具有“-g no”,但在单击Command1时不会更改。有什么解决办法吗?可能是一件很简单的事情,但我就是没有成功\ 我的代码: Private Sub Command1_Click() If Check1.Enabled = True Then If TextPass.Text = "" Then Text1.Text = "-o " & TextPool.Te
Private Sub Command1_Click()
If Check1.Enabled = True Then
If TextPass.Text = "" Then
Text1.Text = "-o " & TextPool.Text & ":" & TextPort.Text & " -u " & TextUser.Text & " -g yes " & "-t " & Combo1.ListIndex
Else
Text1.Text = "-o " & TextPool.Text & ":" & TextPort.Text & " -u " & TextUser.Text & " -p " & TextPass.Text & " -g yes " & "-t " & Combo1.ListIndex
End If
Else
If TextPass.Text = "" Then
Text1.Text = "-o " & TextPool.Text & ":" & TextPort.Text & " -u " & TextUser.Text & " -g no " & "-t " & Combo1.ListIndex
Else
Text1.Text = "-o " & TextPool.Text & ":" & TextPort.Text & " -u " & TextUser.Text & " -p " & TextPass.Text & " -g no " & "-t " & Combo1.ListIndex
End If
End If
End Sub
谢谢你的帮助!或者只是修复我的代码。因为您可以选中或取消选中
Check1
,很明显它已启用,因此您的条件
If Check1.Enabled = True Then
If Check1.Value = 1 Then
永远都是真的。实际上,您要做的是查看是否选中了带有条件的Check1
If Check1.Enabled = True Then
If Check1.Value = 1 Then
你所要做的就是改变 check1.enabled=true 。。进入: check1.value=vbchecked 结果如下,(请别忘了给我的答案打分!谢谢!)
那不行。你测试过了吗?“找不到方法或数据成员。”。那支票1.支票是否存在我没有测试它。这就是我总是检查复选框是否被选中的方式。使用其他选项编辑我的答案。@user2404495:如果有帮助,您应该这样做。你可能还想问一些其他问题,比如