<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/docgen.php"?>

<document version="0.1">
	<name>Adding Simple Controls to Forms</name>
	<category>Knowledge Base</category>
	<author>
		<name>Ashutosh Mukherjee</name>
		<email>ashutosh@desdevpro.com</email>
		<website>http://www.desdevpro.com</website>
	</author>
	<date>11 Aug 2009</date>
	<tags>
		<tag>Visual Basic</tag>
		<tag>VB.NET</tag>
		<tag>Tutorial Series</tag>
	</tags>
	
	<intro>
		Welcome to Visual Basic 2008, the most mature version yet of the most popular programming
language for building Windows and web applications. I will help you build your concepts bit-by-bit in this tutorial series. Think of this as an e-Classroom. If you have any comments/questions, you can use the comments box on the right, or you can contact me through e-mail.
	</intro>
	
	<para>
		<heading level='1'>Adding Controls to Forms</heading>
		
		<text>Let's start by adding a textbox to our form. With the tools displayed, do the following:</text>
		<endl/>

		<bullet> Locate the TextBox tool</bullet>
		<bullet> Double click the icon</bullet>
		<bullet> A textbox is added to your form</bullet>
		<bullet> Alternatively, Click and drag the textbox on the form from the toolbox.</bullet>
		<endl/>
		<image position='right'>004_img1.jpg</image>
		<text>The textbox gets added to the top left position of your form. To move it down, hold your mouse over the textbox and drag to a new position:</text>
		<text>Notice the small squares around the textbox. These are sizing handles. Move your mouse over one of them. The mouse pointer turns into an extended line with arrowheads. Hold your left mouse button down and drag outwards. The textbox is resized. Play around with the sizing handles until you're happy with the size of your textbox.</text>
		<endl/>
		<text>One thing you will notice is that you can't make the size any higher, but you can make it wider. The reason why you can't make it any higher is because the default action of a textbox is to have it contain only a single line of text. If it's only going to contain one line of text, Microsoft reasoned, there's no reason why you should be able to change its height. A textbox can only be made higher if it's set to contain multiple lines of text. You'll see how to do this soon.</text>
		<endl/>

		<bullet>Create two more textboxes by double clicking on the textbox icon in the toolbar (OR Right-click on the selected textbox and choose Copy. Then Right-click on the Form and choose Paste. OR Hold your Left Mouse Button on the textbox and then press CTRL and drag to the new position.)</bullet>
		<bullet> Resize them to the same size as your first one</bullet>
		<bullet> Line them up one below the other with space in between</bullet>
		<bullet> Try to create something that looks like the one below</bullet>

		<image>004_img2.jpg</image>
	</para>
	<para>
		<heading level='1'>Adding Labels</heading>
		<text>Let's add some labels near the textboxes so that your users will know what they are for.</text>
		<endl/>

		<bullet> Locate the label control in the toolbox</bullet>
		<bullet> Double click the label icon</bullet>
		<bullet> A new label is added to your form</bullet>
		<bullet> Alternatively, Click and drag the label on the form from the toolbox.</bullet>
		<bullet> It should look like the one below</bullet>

		<image>004_img3.jpg</image>
		<text>Click on the label to select it. Now hold your left mouse button down on the label. Keep it held down and drag it to the left of the textbox.</text>
		<endl/>
		<text>Create two more labels, and position them to the left of the textboxes. You should now have a form like this one:</text>
		<image>004_img4.jpg</image>
			
	</para>
	<para>
		<heading level='1'>See it in action!</heading>
		<text>To see what your Form looks like as a program, click Debug > Start from the menu bar. Or press F5 on your keyboard</text>
		
		<text>To stop the program from running, you can do one of the following:</text>
		
		<bullet> Click the Red X at the top right of your Form</bullet>
		<bullet> Click Debug > Stop Debugging from the menu bar</bullet>
		<bullet> Press Shift + F5 on your keyboard</bullet>
		<endl/>
		<image position='left'>004_img5.jpg</image>
		<image position='right'>004_img6.jpg</image>
		<clr/>
		
		<text>You can also click the Stop button on the VB toolbars at the top, as shown</text>
		<image position='right'>004_img7.jpg</image>
		
		<text>All right, we're getting somewhere. We now have a form with textboxes and labels, something that looks like a form people can fill in. But those labels are not exactly descriptive, and our textboxes have the default text in them. So how can we enter our own text for the labels, and get rid of that default text for the textboxes? To do those things, we need to discuss something called a Property.
		</text>
		<endl/>
		<text>To be continued...</text>
	</para>
	</document>