<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title>p2p.wrox.com Forums - Visual Basic 2008 Essentials</title>
		<link>http://p2p.wrox.com</link>
		<description>If you are new to Visual Basic programming with version 2008, this is the place to start your questions.</description>
		<language>en</language>
		<lastBuildDate>Sat, 21 Nov 2009 14:41:22 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://p2p.wrox.com/images/misc/rss.jpg</url>
			<title>p2p.wrox.com Forums - Visual Basic 2008 Essentials</title>
			<link>http://p2p.wrox.com</link>
		</image>
		<item>
			<title>RADIOBUTTONS/CHECKBOXES</title>
			<link>http://p2p.wrox.com/visual-basic-2008-essentials/76909-radiobuttons-checkboxes.html</link>
			<pubDate>Thu, 05 Nov 2009 01:05:08 GMT</pubDate>
			<description>hi i am new to visual basics and need help on running this example, can some one help me out here thanks.
part 6, the updateSelection? what codes...</description>
			<content:encoded><![CDATA[<div>hi i am new to visual basics and need help on running this example, can some one help me out here thanks.<br />
part 6, the updateSelection? what codes shall i add there, in the example its blank. I have done part 7 and put the part 8 code in the updateSelection procedure. when I run then program the program runs and the form comes up, but when  I click the radiobuttons and checkbox, it dont display as anything in the textbox as required in what part 9 says. CAN SOMEONE PLEASE SHOW ME CODE FOR PART B 6) AND WHAT ELSE I NEED TO ADD TO FULLFILL THE REQUIREMENT. <br />
MANY THANKS.<br />
<br />
Rrquirements and the names used for the form:<br />
<br />
Object 	Property	Setting<br />
Form	Text	The Selection Program<br />
	BackColor	Pale yellow<br />
Label	Name	lblExtras<br />
	Text	Extras<br />
	Font effects	Underlined<br />
	BackColor	Pale yellow<br />
Label	Name	lblDrink<br />
	Text	Drink<br />
	Font effects	Underlined<br />
	BackColor	Pale yellow<br />
<br />
 <br />
<br />
Object 	Property	Setting<br />
Check Box	Name	chkMilk<br />
	Text	Milk<br />
Check Box	Name	chkSugar<br />
	Text	Sugar<br />
Check Box	Name	chkBiscuits<br />
	Text	Biscuits<br />
Radio Button	Name	radTea<br />
	Text	Tea<br />
Radio Button	Name	radHotChocolate<br />
	Text	Hot Chocolate<br />
Radio Button	Name	radCoffee<br />
	Text	Coffee<br />
 Text Box	Name	txtSelection<br />
	TextAlign	MiddleCentre<br />
	BorderStyle	FixedSingle<br />
	BackColor	Pale blue<br />
	Text	(delete any text in this field)<br />
Button	Name	btnExit<br />
	Text	E&amp;xit<br />
	BackColor	Pale red<br />
<br />
<br />
<br />
 <br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Part B      Attaching code (code programming)<br />
<br />
6	The command button along with each of the option buttons and check boxes need to have instructions (or code) associated with them. These instructions are executed on selection of the object (i.e. event driven). Using the code window enter the instructions given below into each of the procedures. Dont worry if the UpdateSelection() code becomes underlined, this will disappear once you have written the UpdateSelection() procedure later on in this tutorial sheet.<br />
<br />
<br />
Private Sub radTea_CheckedChanged(.<br />
        	UpdateSelection()<br />
    	End Sub<br />
<br />
Private Sub radHotChocolate_CheckedChanged(..<br />
   UpdateSelection()<br />
End Sub<br />
<br />
Private Sub radCoffee_CheckedChanged(<br />
   UpdateSelection()<br />
End Sub<br />
<br />
Private Sub chkMilk_CheckedChanged(.<br />
   UpdateSelection()<br />
End Sub<br />
<br />
Private Sub chkSugar_CheckedChanged(.<br />
   UpdateSelection()<br />
End Sub<br />
<br />
Private Sub chkBiscuits_CheckedChanged(.<br />
   UpdateSelection()<br />
End Sub<br />
<br />
<br />
<br />
7.	UpdateSelection is a common procedure that is called by all the option buttons and check boxes. This procedure is not associated with any particular object on the form, but any control can access it. To create the procedure, go to the code window and on a blank line just before the End Class statement the following line of code:-<br />
<br />
Private Sub UpdateSelection()<br />
<br />
<br />
When you press the Enter key the code editor will automatically enter the sub-procedure footer (End Sub) for you.<br />
<br />
 <br />
8	Enter into the UpdateSelection() procedure following lines of code:-<br />
<br />
<br />
<br />
Private Sub UpdateSelection()<br />
        'Declare all variables in the procedure<br />
        Dim Info As String<br />
<br />
        'Tea<br />
        If radTea.Checked = True Then<br />
            Info = &quot;Tea&quot;<br />
        End If<br />
<br />
        'Hot Chocolate<br />
        If radHotChocolate.Checked = True Then<br />
            Info = &quot;Hot Chocolate&quot;<br />
        End If<br />
<br />
        'Coffee<br />
        If radCoffee.Checked = True Then<br />
            Info = &quot;Coffee&quot;<br />
        End If<br />
<br />
        Info = Info + vbCrLf       'Add a blank line to the list<br />
<br />
        'Milk<br />
        If chkMilk.Checked = True Then<br />
            Info = Info + vbCrLf + &quot;Milk&quot;<br />
        Else<br />
            Info = Info + vbCrLf + &quot;No milk&quot;<br />
        End If<br />
<br />
        'Sugar<br />
        If chkSugar.Checked = True Then<br />
            Info = Info + vbCrLf + &quot;Sugar&quot;<br />
        Else<br />
            Info = Info + vbCrLf + &quot;No sugar&quot;<br />
        End If<br />
<br />
        'Biscuits<br />
        If chkBiscuits.Checked = True Then<br />
            Info = Info + vbCrLf + &quot;Biscuits&quot;<br />
        Else<br />
            Info = Info + vbCrLf + &quot;No biscuits&quot;<br />
        End If<br />
<br />
        txtSelection.Text = Info<br />
<br />
    End Sub<br />
<br />
<br />
<br />
9. 	Run your project and test its operation by trying all the options available. If you cannot see all the information in the text box then stop the program and make the text box a bit bigger on the form.</div>

]]></content:encoded>
			<category domain="http://p2p.wrox.com/visual-basic-2008-essentials-358/">Visual Basic 2008 Essentials</category>
			<dc:creator>naruto786</dc:creator>
			<guid isPermaLink="true">http://p2p.wrox.com/visual-basic-2008-essentials/76909-radiobuttons-checkboxes.html</guid>
		</item>
	</channel>
</rss>
