HEELPBOOK - Visual Basic - Understanding Check Boxes ################# The checkbox acts as a "toggle" control: if it’s on, clicking it turns it off; if it’s off, clicking it turns it on. Unlike the option button, the operation of each checkbox on a form or frame is independent of all other checkboxes; changing the status of one does not affect other checkboxes. The program can read or set the status of a checkbox with the Value property (which is the default property of the checkbox). The Value property of a checkbox is of the Integer type. A value of 0 means "off", a value of 1 means "on". You can use the VB constants vbUnchecked or vbChecked for 0 or 1, respectively. Following is a checkbox demo. The form contains 6 checkboxes within a frame, named chkHobby1, chkHobby2, until chkHobby6. The form also contains a command button called cmdOK and a label called lblInfo. The code behind the OK button is: Private Sub cmdOK_Click() Dim strInfo As String strInfo = "Items selected:" If chkHobby1 = vbChecked Then strInfo = strInfo & " aerobics" If chkHobby2 = vbChecked Then strInfo = strInfo & " reading" If chkHobby3 = vbChecked Then strInfo = strInfo & " travel" If chkHobby4 = vbChecked Then strInfo = strInfo & " movies" If chkHobby5 = vbChecked Then strInfo = strInfo & " computers" If chkHobby6 = vbChecked Then strInfo = strInfo & " sports" lblInfo = strInfo End Sub ############ ARTICLE INFO ############# Article Month: March Article Date: 20/03/2012 Permalink: http://heelpbook.altervista.org/2012/visual-basic-understanding-check-boxes/ Source: http://www.vb6.us/tutorials/understanding-check-boxes Language: English View more articles on: http://www.heelpbook.net/ Follow us on Facebook: http://it-it.facebook.com/pages/HeelpBook/100790870008832 Follow us on Twitter: https://twitter.com/#!/HeelpBook Follow us on RSS Feed: http://feeds.feedburner.com/Heelpbook Images: - http://heelpbook.altervista.org/wp-content/uploads/2012/02/6d1d198d039d_EC62/image001.jpg - http://heelpbook.altervista.org/wp-content/uploads/2012/02/6d1d198d039d_EC62/image002.jpg