0% found this document useful (0 votes)
40 views9 pages

Lecture 7

This document discusses using checkboxes in forms. Checkboxes can be used to control formatting of text, such as making it bold, italic, or underlined. Code examples are provided to link checkboxes to changing text formatting when clicked. Additional examples show using checkboxes to insert text from text boxes into a list box.

Uploaded by

Osama Hayder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views9 pages

Lecture 7

This document discusses using checkboxes in forms. Checkboxes can be used to control formatting of text, such as making it bold, italic, or underlined. Code examples are provided to link checkboxes to changing text formatting when clicked. Additional examples show using checkboxes to insert text from text boxes into a list box.

Uploaded by

Osama Hayder
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Lecture 7 : Checkbox

Check box
• Any number of check boxes can be used on a form. They work
independently.
• Its Property value could be changed in design stage manually, or in
running stage by code.
Example
• Design a form with one
text box and three check
boxes such that when
click on boxes the
following is done: change
typing to bold, italic,
underline.
Code
Private Sub Check1_Click()
Text1.FontBold = Check1.Value
End Sub
Private Sub Check2_Click()
Text1.FontItalic = Check2.Value
End Sub
Private Sub Check3_Click()
Text1.FontUnderline = Check3.Value
End Sub
Private sub form_load ()
Text1.text = “”
Check1.caption =“bold”
Check2.caption =“italic”
Check3.caption=“underline”
End sub
Running stage
Example
• Design a form with one list
box and three check boxes
and three text box as shown
in the figure
• The process of the program
that when click on checkbox
will insert what written in
text3 into list1 while when
click on checkbox2 will
insert what written in text3
into list1 while when click
on checkbox3 will insert
what written in text3 into
list1
Code
• Private Sub Check1_Click() • Private Sub Check3_Click()
• If Check1.Value = 1 Then • If Check3.Value = 1 Then
• List1.AddItem (Text1.Text) • List1.AddItem (Text3.Text)
• End If • End If
• End Sub • End Sub

• Private Sub Check2_Click() • Private Sub Form_Load()


• If Check2.Value = 1 Then • Text1.Text = ""
• List1.AddItem (Text2.Text) • Text2.Text = ""
• End If • Text3.Text = ""
• End Sub • End Sub
Running stage

You might also like