Check Box

  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Check Box as PDF for free.

More details

  • Words: 250
  • Pages: 3
Private Sub Check1_Click() Frame1.Enabled = (Check1.Value = vbChecked) End Sub Note that Value is the default property for CheckBox controls, so you can omit it in code. I suggest that you not do that, however, because it would reduce the readability of your code. The following example illustrates the use of CheckBox control * Open a new Project and save the Form as CheckBox.frm and save the Project as CheckBox.vbp * Design the Form as shown below Object Form CheckBox CheckBox CheckBox OptionButton OptionButton OptionButton TextBox CommandButton

Property

Setting

Caption

CheckBox

Name

frmCheckBox

Caption

Bold

Name

chkBold

Caption

Italic

Name

chkItalic

Caption

Underline

Name

chkUnderline

Caption

Red

Name

optRed

Caption

Blue

Name

optBlue

Caption

Green

Name

optGreen

Name

txtDisplay

Text

(empty)

Caption

Exit

Name

cmdExit

Following code is typed in the Click() events of the CheckBoxes Private Sub chkBold_Click() If chkBold.Value = 1 Then txtDisplay.FontBold = True Else txtDisplay.FontBold = False End If End Sub Private Sub chkItalic_Click() If chkItalic.Value = 1 Then txtDisplay.FontItalic = True Else txtDisplay.FontItalic = False End If End Sub Private Sub chkUnderline_Click() If chkUnderline.Value = 1 Then txtDisplay.FontUnderline = True Else txtDisplay.FontUnderline = False End If End Sub Following code is typed in the Click() events of the OptionButtons Private Sub optBlue_Click() txtDisplay.ForeColor = vbBlue End Sub Private Sub optRed_Click() txtDisplay.ForeColor = vbRed End Sub Private Sub optGreen_Click() txtDisplay.ForeColor = vbGreen End Sub To terminate the program following code is typed in the Click() event of the Exit button

Private Sub cmdExit_Click() End End Sub

Related Documents

Check Box
May 2020 6
Check Box List
November 2019 0
Box
November 2019 59
Box
November 2019 56
Box
August 2019 51