(. 10‑13).
. 10‑13.
1) :
cmd
tgl
tgl
2) frmToggleButton.
, , :
Sub frmToggleButton_Initialize()
With frmToggleButton
.cmd.Cancel = True
.Show
End With
End Sub
Click :
Private Sub tgl_Click()
End Sub
Private Sub tgl_Click()
End Sub
Sub ()
If tgl.Value = True And tgl.Value = True Then
MsgBox " !", vbInformation, _
""
ElseIf tgl.Value = True And tgl.Value = False Then
MsgBox " !", vbInformation, _
""
ElseIf tgl.Value = False And tgl.Value = True Then
MsgBox " !", vbInformation, _
""
Else
MsgBox " !", vbInformation, _
""
End If
End Sub
Private Sub cmd_Click()
Unload Me
End Sub
:
1. 11 frmToggleButton_Initialize.
2. frmToggleButton .
(OptionButton)
, . , . , , (Frame).
, , , . 10‑14.
. 10‑14.
0) :
cmd
opt
opt
1) frmOptionButton.
, , :
Sub frmOptionButton_Initialize()
With frmOptionButton
.cmdOK.Default = True
.cmd.Cancel = True
.opt.Value = True
.Show
End With
End Sub
, , Value:
Private Sub cmdOK_Click()
If opt.Value = True Then
MsgBox " !", vbInformation, _
|
|
""
Else
MsgBox " !", vbInformation, _
""
End If
End Sub
Private Sub cmd_Click()
Unload Me
End Sub
:
1. 11 frmOptionButton_Initialize.
2. frmOptionButton .
(SpinButton)
.
, .
:
. 10‑15.
0, 100.
( : ).
.
1) :
txt
txt
: , . !
1- spn
2- spn
cmd
txt
2) frm.
:
1. .
2. ( ):
Private Sub UserForm_Initialize()
spn. Min = 0
spn. Max = 100
spn. SmallChange = 1
spn. Min = 0
spn. Max = 100
spn. SmallChange = 1
cmd. Cancel = True
End Sub
3. ( !) spn - Private Sub spn_Change. :
Private Sub spn_Change()
txt.Value = spn.Value
= 0
If Val (txt.Value) <= Val (txt.Value) Then
For i = Val(txt.Value) To Val(txt.Value)
= + i
Next
txt.Value =
Else
txt.Value = ""
End If
End Sub
4. spn:
Private Sub spn_Change()
txt.Value = spn.Value
= 0
If Val (txt.Value) <= Val (txt.Value) Then
For i = Val(txt.Value) To Val(txt.Value)
= + i
Next
txt.Value =
Else
txt.Value = ""
End If
End Sub
, spn_Change spn_Change . , .
5. / cmd, :
Private Sub cmd_Click()
Unload frm
End Sub
:
ü Val , , .
ü : If Val(txt.Value) <= Val(txt.Value) Then
. , , , , .
ü . , . txt :
|
|
Private Sub txt_Change()
= 0
If Val(txt.Value) <= Val(txt.Value) Then
For i = Val(txt.Value) To Val(txt.Value)
= + i
Next
txt.Value =
Else
txt.Value.Value = ""
End If
End Sub
txt, ( ).
6. , . , . , IsNumeric. :
Private Sub txt_Change()
If IsNumeric (txt.Value) = True Then
= 0
If Val(txt.Value) <= Val(txt.Value) Then
For i = Val(txt.Value) To Val(txt.Value)
= + i
Next
txt.Value =
Else
txt.Value.Value = ""
End If
Else: MsgBox " !"
End If
End Sub