<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7815194795950484733</id><updated>2011-11-27T15:38:47.173-08:00</updated><category term='lesson 9'/><category term='lesson 13'/><category term='Lesson 2'/><category term='label 14'/><category term='UCP'/><category term='lesson 6'/><category term='Lesson 10'/><category term='lesson 5'/><category term='Test Page'/><category term='lesson 15'/><category term='lesson 4'/><category term='label 12'/><category term='lesson 11'/><category term='language'/><category term='character'/><category term='lesson 16'/><category term='lesson'/><category term='lesson 8'/><category term='lesson 7'/><category term='evolution'/><category term='lesson 3'/><title type='text'>Kependidikan Islam</title><subtitle type='html'>contoh isi deskripsi kependidikan islam</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-2162562299136574992</id><published>2011-01-10T19:04:00.000-08:00</published><updated>2011-01-10T19:04:29.049-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Test Page'/><title type='text'>test Page</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;img border="0" height="221" src="http://1.bp.blogspot.com/_IQNllxJ00oI/TSvCLMcrYMI/AAAAAAAAAOk/jYy9ZaLWIto/s320/UnderConstructionPage.gif" width="320" /&gt; tes page....&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;under construction&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;under construction&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;under construction&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;under construction&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;under construction&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt; &lt;/div&gt;&lt;span id="fullpost"&gt; &lt;br /&gt;under construction&lt;br /&gt;under construction&lt;br /&gt;under construction&lt;br /&gt;under construction&lt;br /&gt;under construction&lt;br /&gt;under construction&lt;br /&gt;Achmad Yazid BAstomi  &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-2162562299136574992?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/2162562299136574992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2011/01/test-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/2162562299136574992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/2162562299136574992'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2011/01/test-page.html' title='test Page'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_IQNllxJ00oI/TSvCLMcrYMI/AAAAAAAAAOk/jYy9ZaLWIto/s72-c/UnderConstructionPage.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-7763850147859940987</id><published>2011-01-10T18:37:00.000-08:00</published><updated>2011-01-10T18:37:10.658-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UCP'/><title type='text'>UNDER CONSTRUCTON PAGE</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_IQNllxJ00oI/TSvCLMcrYMI/AAAAAAAAAOk/jYy9ZaLWIto/s1600/UnderConstructionPage.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="221" src="http://1.bp.blogspot.com/_IQNllxJ00oI/TSvCLMcrYMI/AAAAAAAAAOk/jYy9ZaLWIto/s320/UnderConstructionPage.gif" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span id="fullpost"&gt;   &lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-7763850147859940987?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/7763850147859940987/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2011/01/under-constructon-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7763850147859940987'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7763850147859940987'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2011/01/under-constructon-page.html' title='UNDER CONSTRUCTON PAGE'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_IQNllxJ00oI/TSvCLMcrYMI/AAAAAAAAAOk/jYy9ZaLWIto/s72-c/UnderConstructionPage.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-4714759000408318315</id><published>2010-07-27T00:16:00.000-07:00</published><updated>2011-01-28T23:59:45.123-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 16'/><title type='text'>LESSON 16. ARRAYS</title><content type='html'>&lt;style type="text/css"&gt; &lt;!--  @page { margin: 0.79in }  H3 { margin-bottom: 0.04in }  H3.western { font-family: "Arial", sans-serif; font-size: 13pt }  H3.cjk { font-family: "DejaVu Sans"; font-size: 13pt }  H3.ctl { font-family: "DejaVu Sans"; font-size: 13pt }  P { margin-bottom: 0.08in } --&gt; &lt;/style&gt;  &lt;br /&gt;&lt;h3 class="western"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;16.1 Introduction to Arrays&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;By definition, an array is a list of variables, all with the same data type and name. When we work with a single item, we only need to use one variable. However, if we have a list of items which are of similar type to deal with, we need to declare an array of variables instead of using a variable for each item. For example, if we need to enter one hundred names, we might have difficulty in declaring 100 different names, this is a waste of time and efforts. So,&amp;nbsp; instead of declaring one hundred different variables, we need to declare only one array.&amp;nbsp; We differentiate each item in the array by using subscript, the index value of each item, for example name(1), name(2),name(3) .......etc. , which will make declaring variables streamline and much systematic.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;b&gt;16.2 Dimension of an Array&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;An array can be one dimensional or multidimensional. One dimensional array is like a list of items or a table that consists of one row of items or one column of items. A twodimensional array will be a table of items that make up of rows and columns. While the format for a one dimensional array is ArrayName(x), the format for a two dimensional array is ArrayName(x,y) while a three dimensional array is ArrayName(x,y,z) . Normally it is sufficient to use one dimensional and two dimensional array ,you only need to use higher dimensional arrays if you need with engineering problems or even some accounting problems.Let me illustrates the the arrays with tables.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Table 16.1. One dimensional Array&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;style type="text/css"&gt; &lt;!--  @page { margin: 0.79in }  H3 { margin-bottom: 0.04in }  H3.western { font-family: "Arial", sans-serif; font-size: 13pt }  H3.cjk { font-family: "DejaVu Sans"; font-size: 13pt }  H3.ctl { font-family: "DejaVu Sans"; font-size: 13pt }  P { margin-bottom: 0.08in } --&gt; &lt;/style&gt;  &lt;br /&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;table border="1" bordercolor="#c0c0c0" cellpadding="0" cellspacing="3" style="width: 510px;"&gt;&lt;col width="61"&gt;&lt;/col&gt;  &lt;col width="70"&gt;&lt;/col&gt;  &lt;col width="70"&gt;&lt;/col&gt;  &lt;col width="70"&gt;&lt;/col&gt;  &lt;col width="70"&gt;&lt;/col&gt;  &lt;col width="70"&gt;&lt;/col&gt;  &lt;col width="70"&gt;&lt;/col&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td bgcolor="#ffd320" width="61"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Student Name&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="70"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(1)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="70"&gt;&lt;div style="background: none repeat scroll 0% 0% transparent;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(2)&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="70"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(3)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="70"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(4)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="70"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(5)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="70"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(6)&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Table 16.2 Two Dimensional Array&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;table border="1" bordercolor="#c0c0c0" cellpadding="0" cellspacing="3" style="width: 362px;"&gt;&lt;col width="85"&gt;&lt;/col&gt;  &lt;col width="86"&gt;&lt;/col&gt;  &lt;col width="86"&gt;&lt;/col&gt;  &lt;col width="86"&gt;&lt;/col&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td bgcolor="#ffd320" width="85"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(1,1)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(1,2)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(1,3)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(1,4)&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td bgcolor="#ffd320" width="85"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(2,1)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(2,2)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(2,3)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(2,4)&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td bgcolor="#ffd320" width="85"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(3,1)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(3,2)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(3,3)&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="86"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;Name(3,4)&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;h3 class="western"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;16.2 Declaring Arrays&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;We could use Public or Dim statement to declare an array just as the way we declare a single variable. The Public statement declares an array that can be used throughout an application while the Dim statement declare an array that could be used only in a local procedure.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;The general format to declare a one dimensional array is as follow:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim arrayName(subs) as dataType&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;where subs indicates the last subscript in the array.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;Example 16.1&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim CusName(10) as String&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;will declare an array that consists of 10 elements if the statement&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Option Base 1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;appear in the declaration area, starting from CusName(1) to CusName(10). Otherwise, there will be 11 elements in the array starting from CusName(0) through to CusName(10)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;table border="1" bordercolor="#c0c0c0" cellpadding="1" cellspacing="3" style="width: 566px;"&gt;&lt;col width="51"&gt;&lt;/col&gt;  &lt;col width="50"&gt;&lt;/col&gt;  &lt;col width="50"&gt;&lt;/col&gt;  &lt;col width="50"&gt;&lt;/col&gt;  &lt;col width="50"&gt;&lt;/col&gt;  &lt;col width="50"&gt;&lt;/col&gt;  &lt;col width="50"&gt;&lt;/col&gt;  &lt;col width="50"&gt;&lt;/col&gt;  &lt;col width="50"&gt;&lt;/col&gt;  &lt;col width="56"&gt;&lt;/col&gt;  &lt;tbody&gt;&lt;tr&gt;   &lt;td bgcolor="#ffd320" width="51"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(1)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="50"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(2)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="50"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(3)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="50"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(4)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="50"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(5)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="50"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(6)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="50"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(7)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="50"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(8)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="50"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(9)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;   &lt;td bgcolor="#ffd320" width="56"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;CusName(10)&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;Example 16.2&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim Count(100 to 500) as Integer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;declares an array that consists of the first element starting from Count(100) and ends at Count(500)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;The general format to declare a two dimensional array is as follow:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim ArrayName(Sub1,Sub2) as dataType&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Example 16.3&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim StudentName(10,10) will declare a 10x10 table make up of 100 students' Names, starting with StudentName(1,1)&amp;nbsp; and end with StudentName(10,10).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;/div&gt;&lt;div style="line-height: 0.17in; margin-bottom: 0in; margin-top: 0.01in;"&gt;&lt;style type="text/css"&gt; &lt;!--  @page { margin: 0.79in }  H3 { margin-bottom: 0.04in }  H3.western { font-family: "Arial", sans-serif; font-size: 13pt }  H3.cjk { font-family: "DejaVu Sans"; font-size: 13pt }  H3.ctl { font-family: "DejaVu Sans"; font-size: 13pt }  P { margin-bottom: 0.08in } --&gt; &lt;/style&gt;&lt;span id="fullpost"&gt;  &lt;/span&gt;&lt;/div&gt;&lt;h3 class="western"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;16.3 Sample Programs&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;(i)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;The code&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim studentName(10) As String&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim num As Integer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Private Sub addName()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;For num = 1 To 10&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;studentName(num) = InputBox("Enter the student name", "Enter Name", "", 1500, 4500)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;If studentName(num) &amp;lt;&amp;gt; "" Then&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Form1.Print studentName(num)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Else&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;End&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;End If&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;The above program accepts data entry through an input box and displays the entries in the form itself. As you can see, this program will only allows a user to enter 10 names each time he click on the start button.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;(ii)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: #000099;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;The Code&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim studentName(10) As String&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Dim num As Integer&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Private Sub addName( )&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;For num = 1 To 10&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;studentName(num) = InputBox("Enter the student name")&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;List1.AddItem studentName(num)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;Private Sub Start_Click()&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;addName&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: #3333ff;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0.19in; margin-top: 0.19in;"&gt;&lt;span id="fullpost"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;The above program accepts data entries through an InputBox and displays the items in a list box.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0in;"&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="fullpost"&gt;&amp;nbsp; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-4714759000408318315?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/4714759000408318315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2010/07/lesson-16-arrays.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/4714759000408318315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/4714759000408318315'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2010/07/lesson-16-arrays.html' title='LESSON 16. ARRAYS'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-1161010996454488996</id><published>2009-12-19T06:11:00.000-08:00</published><updated>2010-05-28T02:30:33.700-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 15'/><title type='text'>Lesson 15: Creating  VBA  Functions For MS Excel</title><content type='html'>&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana;"&gt;15.1 The Needs to Create VBA Functions in MS-Excel&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;You can create&amp;nbsp; your own functions to supplement the&amp;nbsp; built-in functions in Microsoft Excel spreadsheet, which are quite limited in some aspects. These user-defined&amp;nbsp; functions are also called&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Visual Basic for Applications&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;functions, or simply VBA functions. They are very useful and powerful if you know how to program them properly. One main reason we need to create user defined functions is to enable us to customize our spreadsheet environment for individual needs. For example, we might need a function that could calculate commissions payment based on the sales volume, which is quite difficult if not impossible by using the built-in functions alone. The code for VBA is illustrated on the right.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Table 15.1: Commissions Payment Table&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;table border="0" cellpadding="0" class="MsoNormalTable" style="background: none repeat scroll 0% 0% rgb(255, 255, 204); width: 55%;"&gt;&lt;tbody&gt;&lt;tr&gt;   &lt;td style="background: none repeat scroll 0% 0% rgb(255, 204, 153); padding: 0.75pt; width: 131.25pt;" width="175"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Sales   Volume($)&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: none repeat scroll 0% 0% rgb(255, 204, 153); padding: 0.75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Commissons&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 131.25pt;" width="175"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&amp;lt;500&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;3%&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 131.25pt;" width="175"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&amp;lt;1000&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;6%&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 131.25pt;" width="175"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&amp;lt;2000&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;9%&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 131.25pt;" width="175"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&amp;lt;5000&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;12%&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr&gt;   &lt;td style="padding: 0.75pt; width: 131.25pt;" width="175"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&amp;gt;5000&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;15%&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;In table 15.1, when a salesman attain a sale volume of&amp;nbsp; $6000, he will be paid $6000x15%=$720.00. A visual basic function to calculate the commissions can be written as follows:&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Function Comm(Sales_V&amp;nbsp; As Variant) as Variant&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;If Sales_V &amp;lt;500 Then&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Comm=Sales_V*0.03&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Elseif Sales_V&amp;gt;=500 and Sales_V&amp;lt;1000 Then&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Comm=Sales_V*0.06&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Elseif Sales_V&amp;gt;=1000 and Sales_V&amp;lt;2000 Then&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Comm=Sales_V*0.09&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Elseif Sales_V&amp;gt;=200 and Sales_V&amp;lt;5000 Then&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Comm=Sales_V*0.12&lt;br /&gt;Elseif Sales_V&amp;gt;=5000&amp;nbsp; Then&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Comm=Sales_V*0.15&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;End If&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;End Function&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="line-height: 12pt;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana;"&gt;15.2 Using Microsoft Excel Visual Basic&amp;nbsp; Editor&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12pt; margin: 0.75pt 0cm;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;To create VBA functions in MS Excel, you can&amp;nbsp; click on tools,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12pt; margin: 0.75pt 0cm;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;select macro and then click on Visual Basic Editor as shown in Figure 15.1&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp; Figure 15.1: Inserting MS_Excel Visual Basic Editor&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_IQNllxJ00oI/SyzcrYQ6cnI/AAAAAAAAANg/3qQyoDmdm-8/s1600-h/image1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="243" src="http://3.bp.blogspot.com/_IQNllxJ00oI/SyzcrYQ6cnI/AAAAAAAAANg/3qQyoDmdm-8/s320/image1.JPG" width="320" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Upon clicking the Visual Basic Editor, the VB Editor windows will appear as shown in figure 15.2. To create a function, type in the function as illustrated in section 15.1 above After typing, save the&amp;nbsp; file and then return to the Excel windows.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div align="center" style="text-align: center;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Figure 15.2 : The VB Editor&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_IQNllxJ00oI/SyzcrjuDRCI/AAAAAAAAANk/SuYFG_fBirg/s1600-h/image2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://2.bp.blogspot.com/_IQNllxJ00oI/SyzcrjuDRCI/AAAAAAAAANk/SuYFG_fBirg/s320/image2.JPG" width="320" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;In the Excel window, type in the titles Sales Volume and Commissions in any two cells. By referring to figure 15.3, key-in the Comm function at cell C4 and by referencing the value in cell B4, using the format Comm(B4). Any value appear in cell B4 will pass the value to the Comm function in cell C4. For the rest of the rows, just copy the formula by&amp;nbsp; dragging&amp;nbsp; the bottom right corner of cell C4 to the required cells, a nice and neat table that shows the commissions will automatically appear (as shown in figure 15.3). It can also be updated anytime&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div align="center" style="line-height: 15pt; text-align: center;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;b&gt;&lt;span style="color: #333333; font-family: Arial; font-size: 10pt;"&gt;Figure 15.3: MS Excel Windows- Sales Volume&lt;/span&gt;&lt;/b&gt;&lt;span style="color: #333333;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;a href="http://4.bp.blogspot.com/_IQNllxJ00oI/SyzcrkIHkII/AAAAAAAAANo/uMDShXeCZNI/s1600-h/image3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://4.bp.blogspot.com/_IQNllxJ00oI/SyzcrkIHkII/AAAAAAAAANo/uMDShXeCZNI/s320/image3.JPG" width="320" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18pt;"&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span id="fullpost"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-1161010996454488996?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/1161010996454488996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/12/lesson-15-creating-vba-functions-for-ms.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/1161010996454488996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/1161010996454488996'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/12/lesson-15-creating-vba-functions-for-ms.html' title='Lesson 15: Creating  VBA  Functions For MS Excel'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IQNllxJ00oI/SyzcrYQ6cnI/AAAAAAAAANg/3qQyoDmdm-8/s72-c/image1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-840474933055442167</id><published>2009-11-27T00:11:00.000-08:00</published><updated>2009-11-27T00:11:10.677-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='label 14'/><title type='text'>Lesson 14: Creating User-Defined Functions</title><content type='html'>&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana;"&gt;14.1 Creating Your Own Function&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;The general format of a function is as follows:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Public&amp;nbsp; Function&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;functionName&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;(Arg As dataType,..........) As dataType&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;or&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Private&amp;nbsp; Function&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;functionName&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;(Arg As dataType,..........) As dataType&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;* Public indicates that the function is applicable to the whole project and&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; Private indicates that the function is only applicable to a certain module or procedure.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Example 14.1&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;In this example, a user can calculate the future value of a certain amount of money he has today based on the interest rate and the number of years from now,&amp;nbsp; supposing&amp;nbsp; he will invest this amount of money somewhere .The calculation is based on the compound interest rate.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_IQNllxJ00oI/Sw-IvRMYV0I/AAAAAAAAANY/hEKT0bM8QnA/s1600/future%20value%20calculator%2014.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_IQNllxJ00oI/Sw-IvRMYV0I/AAAAAAAAANY/hEKT0bM8QnA/s1600/future%20value%20calculator%2014.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;The code&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;Public Function FV(PV As Variant, i As Variant, n As Variant) As Variant&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;'Formula to calculate Future Value(FV)&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;'PV denotes Present Value&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;FV = PV * (1 + i / 100) ^ n&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;End Function&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;Private Sub compute_Click()&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;'This procedure will calculate Future Value&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;Dim FutureVal As Variant&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;Dim PresentVal As Variant&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;Dim interest As Variant&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;Dim period As Variant&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;PresentVal = PV.Text&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;interest = rate.Text&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;period = years.Text&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;'calling the funciton&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;FutureVal = FV(PresentVal, interest, period)&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;&lt;br /&gt;MsgBox ("The Future Value is " &amp;amp; FutureVal)&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 9pt;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Example 14.2&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;The following program will automatically compute examination grades based on the marks that a student obtained. The code is shown on the right.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_IQNllxJ00oI/Sw-IvhIx14I/AAAAAAAAANc/9xwI6MqvA3U/s1600/14%20form%201.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_IQNllxJ00oI/Sw-IvhIx14I/AAAAAAAAANc/9xwI6MqvA3U/s1600/14%20form%201.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;The Code&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;Public Function grade(mark As Variant) As String&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;Select Case mark&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;Case Is &amp;gt;= 80&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;grade = "A"&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;Case Is &amp;gt;= 70&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;grade = "B"&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;Case Is &amp;gt;= 60&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;grade = "C"&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;Case Is &amp;gt;= 50&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;grade = "D"&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;Case Is &amp;gt;= 40&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;grade = "E"&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;Case Else&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;grade = "F"&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;End Select&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;End Function&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;Private Sub compute_Click()&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;grading.Caption = grade(mark)&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-840474933055442167?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/840474933055442167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/11/lesson-14-creating-user-defined.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/840474933055442167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/840474933055442167'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/11/lesson-14-creating-user-defined.html' title='Lesson 14: Creating User-Defined Functions'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IQNllxJ00oI/Sw-IvRMYV0I/AAAAAAAAANY/hEKT0bM8QnA/s72-c/future%20value%20calculator%2014.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-8031009544285666637</id><published>2009-10-19T07:26:00.001-07:00</published><updated>2009-10-19T07:30:26.397-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 13'/><title type='text'>Lesson 13: String Manipulation Functions</title><content type='html'>&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;In this lesson, we will learn how to use some of the string manipulation function such as&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Len, R&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;ight, Left, Mid, Trim, Ltrim, Rtrim, Ucase, Lcase, Instr, Val, Str&amp;nbsp; ,Chr and Asc.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;(i)The &amp;nbsp;Len Function&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The length function returns an integer value which is the length of a phrase or a sentence, including the empty spaces. The format is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Len (“Phrase”)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Len (VisualBasic) = 11 and Len (welcome to VB tutorial) = 22&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Len function can also return the number of digits or memory locations of a number that is stored in the computer. For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Private sub Form_Activate ( )&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;X=sqr (16)&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Y=1234&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Z#=10#&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Print Len(x), Len(y), and Len (z)&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 6.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;will produce the output&amp;nbsp; 1, 4 , 8. The reason why the last value is 8 is because z# is a double precision number and so it is allocated more memory spaces.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;a href="" name="_Toc123994244"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;(ii) The Right &amp;nbsp;Function&lt;/span&gt;&lt;/a&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Right function extracts the right portion of a phrase. The format is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Right (“Phrase”, n)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Where n is the starting position from the right of the phase where the portion of the phrase is going to be extracted.&amp;nbsp; For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;Right(“Visual Basic”, 4) = asic&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;a href="" name="_Toc123994245"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;(iii)The Left Function&lt;/span&gt;&lt;/a&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Left$ function extract the left portion of a phrase. The format is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Left(“Phrase”, n)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Where n is the starting position from the left of the phase where the portion of the phrase is going to be extracted.&amp;nbsp; For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;Left (“Visual Basic”, 4) = Visu&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;a href="" name="_Toc123994246"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;(iv) The Ltrim Function&lt;/span&gt;&lt;/b&gt;&lt;/a&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Ltrim function trims the empty spaces of the left portion of the phrase. The format is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Ltrim(“Phrase”)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;.For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;Ltrim (“&amp;nbsp; Visual Basic”, 4)= Visual basic&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;a href="" name="_Toc123994247"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;(v) The Rtrim Function&lt;/span&gt;&lt;/a&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Rtrim function trims the empty spaces of the right portion of the phrase. The format is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Rtrim(“Phrase”)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;.For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&lt;br /&gt;Rtrim (“Visual Basic&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ”, 4) = Visual basic&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 34.5pt; margin-right: 0cm; margin-top: 8.25pt; text-indent: -34.5pt;"&gt;&lt;a href="" name="_Toc123994248"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;(vi)&lt;/span&gt;&lt;/a&gt;&lt;span style="mso-bookmark: _Toc123994248;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; font-weight: normal; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _Toc123994248;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Trim function&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Ttrim function trims the empty spaces on both side of the phrase. The format is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Trim(“Phrase”)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;.For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Trim (“&amp;nbsp;&amp;nbsp; Visual Basic&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ”) = Visual basic&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;a href="" name="_Toc123994249"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;(viii)&lt;/span&gt;&lt;/a&gt;&lt;span style="mso-bookmark: _Toc123994249;"&gt;&lt;span class="apple-converted-space"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _Toc123994249;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Mid Function&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Mid&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;function extracts a substring from the original phrase or string. It takes the following format:&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Mid(phrase, position, n)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Where position is the starting position of the phrase from which the extraction process will start and n is the number of characters to be extracted. For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Mid(“Visual Basic”, 3, 6) = ual Bas&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&lt;br /&gt;(&lt;a href="" name="_Toc123994250"&gt;ix) The InStr function&lt;/a&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _Toc123994250;"&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;The&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;InStr&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;function looks for a phrase that is embedded within the original phrase and returns the starting position of the embedded phrase. The format is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Instr (n, original phase, embedded phrase)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Where n is the position where the Instr function will begin to look for the embedded phrase. For example&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Instr(1, “Visual Basic”,” Basic”)=8&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;a href="" name="_Toc123994251"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;(x)&lt;/span&gt;&lt;/a&gt;&lt;span style="mso-bookmark: _Toc123994251;"&gt;&lt;span class="apple-converted-space"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _Toc123994251;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Ucase and the Lcase functions&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Ucase&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;function converts all the characters of a string to capital letters. On the other hand, the&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Lcase&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;function converts all the characters of a string to small letters. For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Ucase(“Visual Basic”) =VISUAL BASiC&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Lcase(“Visual Basic”) =visual basic&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;a href="" name="_Toc123994252"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&lt;br /&gt;(xi) The Str and Val functions&lt;/span&gt;&lt;/a&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Str&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;is the function that converts a number to a string while the&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Val&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;function converts a string to a number. The two functions are important when we need to perform mathematical operations.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;h4 style="line-height: 14.25pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;a href="" name="_Toc123994253"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;(xii)&lt;/span&gt;&lt;/a&gt;&lt;span style="mso-bookmark: _Toc123994253;"&gt;&lt;span class="apple-converted-space"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bookmark: _Toc123994253;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Chr and the Asc functions&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Chr&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;function returns the string that corresponds to an ASCII code while the&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Asc&lt;/b&gt;function converts an ASCII character or symbol to the corresponding ASCII code. ASCII stands for “American Standard Code for Information Interchange”. Altogether there are 255 ASCII codes and as many ASCII characters. Some of the characters may not be displayed as they may represent some actions such as the pressing of a key or produce a beep sound. The format of the Chr function is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Chr(charcode)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;and the format of the Asc function is&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Asc(Character)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The following are some examples:&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 9.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 8.25pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Chr(65)=A, Chr(122)=z, Chr(37)=% , Asc(“B”)=66, Asc(“&amp;amp;”)=38&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-8031009544285666637?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/8031009544285666637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/10/lesson-13-string-manipulation-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/8031009544285666637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/8031009544285666637'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/10/lesson-13-string-manipulation-functions.html' title='Lesson 13: String Manipulation Functions'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-2703375454117979827</id><published>2009-10-01T07:22:00.000-07:00</published><updated>2009-10-01T07:22:00.814-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='label 12'/><title type='text'>Lesson 12:  Formatting Functions</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Formatting output is a very important part of programming so that the data can be presented systematically and clearly to the users. Data in the previous lesson were presented fairly systematically through the use of commas and some of the functions like Int, Fix and Round. However, to have better control of the output format, we can use a number of formatting functions in Visual basic.&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;The three most common formatting functions in VB are&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Tab&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;,&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Space&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;, and&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Format&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;(i) The Tab function&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Tab (n); x&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;The item x will be displayed at a position that is n spaces from the left border of the output form. There must be a semicolon in between Tab and the items you intend to display (VB will actually do it for you automatically).&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example1&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;.Private Sub Form_Activate&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Print "I"; Tab(5); "like"; Tab(10); "to"; Tab(15); "learn"; Tab(20); "VB"&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Print&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Print Tab(10); "I"; Tab(15); "like"; Tab(20); "to"; Tab(25); "learn"; Tab(20); "VB"&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;Print&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Print Tab(15); "I"; Tab(20); ; "like"; Tab(25); "to"; Tab(30); "learn"; Tab(35); “VB"&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End sub&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;The Output for example 1 is shown below:&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_IQNllxJ00oI/SsS5bv49bnI/AAAAAAAAANA/CQvRGifaXg0/s1600-h/figure13.1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_IQNllxJ00oI/SsS5bv49bnI/AAAAAAAAANA/CQvRGifaXg0/s320/figure13.1.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;(ii) The Space function&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;The&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Space&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;function is very closely linked to the Tab function. However, there is a minor difference. While Tab (n) means the item is placed n spaces from the left border of the screen, the Space function specifies the number of spaces between two consecutive items. For example, the procedure&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&lt;b&gt;Example 2&lt;/b&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Private Sub Form_Activate()&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Print "Visual"; Space(10); "Basic"&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Means that the words Visual and Basic will be separated by 10 spaces&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;(iii) The Format function&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;The&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Format&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;function&lt;/span&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;is a very powerful formatting function which can display the numeric values in various forms. There are two types of Format function, one of them is the built-in or predefined format while another one can be defined by the users.&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;(i) The format of the predefined Format function is&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Format (n, “style argument”)&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;where n is a number and the list of style arguments is given in the table&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;table border="0" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-collapse: collapse; mso-padding-alt: 0cm 0cm 0cm 0cm;"&gt;&lt;tbody&gt;&lt;tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0;"&gt;   &lt;td style="border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 77.4pt;" valign="top" width="103"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Style   argument&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-left: none; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 153.0pt;" valign="top" width="204"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Explanation&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-left: none; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 234.0pt;" valign="top" width="312"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 1;"&gt;   &lt;td style="border-top: none; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 77.4pt;" valign="top" width="103"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;General   Number&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 153.0pt;" valign="top" width="204"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;To   display the number without having separators between thousands.&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 234.0pt;" valign="top" width="312"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Format(8972.234,   “General Number”)=8972.234&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 2;"&gt;   &lt;td style="border-top: none; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 77.4pt;" valign="top" width="103"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Fixed&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 153.0pt;" valign="top" width="204"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;To   display the number without having separators between thousands and rounds it   up to two decimal places.&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 234.0pt;" valign="top" width="312"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Format(8972.2,   “Fixed”)=8972.23&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 3;"&gt;   &lt;td style="border-top: none; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 77.4pt;" valign="top" width="103"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Standard&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 153.0pt;" valign="top" width="204"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;To   display the number with separators or separators between thousands and rounds   it up to two decimal places.&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 234.0pt;" valign="top" width="312"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Format(6648972.265,   “Standard”)= 6,648,972.27&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 4;"&gt;   &lt;td style="border-top: none; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 77.4pt;" valign="top" width="103"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Currency&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 153.0pt;" valign="top" width="204"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;To   display the number with the dollar sign in front, has separators between   thousands as well as rounding it up to two decimal places.&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 234.0pt;" valign="top" width="312"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Format(6648972.265,   “Currency”)= $6,648,972.27&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 5; mso-yfti-lastrow: yes;"&gt;   &lt;td style="border-top: none; border: solid windowtext 1.0pt; padding: 0cm 5.4pt 0cm 5.4pt; width: 77.4pt;" valign="top" width="103"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Percent&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 153.0pt;" valign="top" width="204"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Converts   the number to the percentage form and displays a % sign and rounds it up to   two decimal places.&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="border-bottom: solid windowtext 1.0pt; border-left: none; border-right: solid windowtext 1.0pt; border-top: none; padding: 0cm 5.4pt 0cm 5.4pt; width: 234.0pt;" valign="top" width="312"&gt;   &lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Format(0.56324,   “Percent”)=56.32 %&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example 3&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Private Sub Form_Activate()&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Print Format (8972.234, "General Number")&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Print Format (8972.2, "Fixed")&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Print Format (6648972.265, "Standard")&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Print Format (6648972.265, "Currency")&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Print Format (0.56324, "Percent")&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Now, run the program and you will get an output like the figure below:&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_IQNllxJ00oI/SsS59w6zYHI/AAAAAAAAANQ/809JdJgWV4g/s1600-h/figure13.4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_IQNllxJ00oI/SsS59w6zYHI/AAAAAAAAANQ/809JdJgWV4g/s320/figure13.4.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-2703375454117979827?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/2703375454117979827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/10/lesson-12-formatting-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/2703375454117979827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/2703375454117979827'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/10/lesson-12-formatting-functions.html' title='Lesson 12:  Formatting Functions'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_IQNllxJ00oI/SsS5bv49bnI/AAAAAAAAANA/CQvRGifaXg0/s72-c/figure13.1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-7015275863678683112</id><published>2009-09-08T06:53:00.000-07:00</published><updated>2009-09-08T06:53:40.558-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 11'/><title type='text'>Lesson 11: Mathematical Functions</title><content type='html'>&lt;div class="MsoNormal"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;The mathematical functions are very useful and important in programming because very often we need to deal with mathematical concepts in programming such as chance and probability, variables, mathematical logics, calculations, coordinates, time intervals and etc. The common mathematical functions in Visual Basic are&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;Rnd, Sqr, Int, Abs, Exp, Log, Sin, Cos, Tan , Atn, Fix&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;and&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;Round.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;(i)&lt;b&gt; Rnd&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;&amp;nbsp;&amp;nbsp;is very useful when we deal with the concept of chance and probability. The Rnd function returns a random value between 0 and 1. In Example 1. When &amp;nbsp;you run the program, you will get an output of 10 random numbers between 0 and 1. Randomize Timer is a vital statement here as it will randomize the process.&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;b&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example 1:&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Private Sub Form_Activate&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Randomize Timer&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;For x=1 to 10&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Print&amp;nbsp; Rnd&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Next x&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;The Output for example 1 is shown below:&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_IQNllxJ00oI/SqZhaDHXI1I/AAAAAAAAAMo/uDWU1KRcCuk/s1600-h/figure+11.1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_IQNllxJ00oI/SqZhaDHXI1I/AAAAAAAAAMo/uDWU1KRcCuk/s320/figure+11.1.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Random numbers in its original form are not very useful in programming until we convert them to integers. For example, if we need to obtain a random output of 6 random integers ranging from 1 to 6, which make the program behave as a virtual die, we need to convert the random numbers using the format&amp;nbsp;&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Int(Rnd*6)+1&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;. Let’s study the following example:&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;In this example, Int(Rnd*6) will generate a random integer between 0 and 5 because the function&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;Int&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;truncates the decimal part of the random number and returns an integer. After adding 1, you will get a random number between 1 and 6 every time you click the command button. For example, let say the random number generated is 0.98, after multiplying it by 6, it becomes 5.88, and using the integer function Int(5.88) will convert the number to 5; and after adding 1 you will get 6.&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;In this example, you place a command button and change its caption to ‘roll die’. You also need to insert a label into the form and clear its caption at the designing phase and make its font bigger and bold. Then set the border value to 1 so that it displays a border; and after that set the alignment to center. The statement Label1.Caption=Num means the integer generated will be displayed as the caption of the label.&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;b&gt;Example 2:&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 0cm; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim num as integer&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Private Sub Command1_Click ( )&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Randomize Timer&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Num=Int(Rnd*6)+1&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Label1.Caption=Num&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 3.75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Now, run the program and then click on the roll die button, you will get an output like the figure below:&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_IQNllxJ00oI/SqZhfeQxJeI/AAAAAAAAAMw/dlsl8G4iJUo/s1600-h/figure+11.2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_IQNllxJ00oI/SqZhfeQxJeI/AAAAAAAAAMw/dlsl8G4iJUo/s320/figure+11.2.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;h4&gt;&lt;a href="" name="_Toc123994226"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The Numeric Functions&lt;/span&gt;&lt;/a&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;The numeric functions are&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Int&lt;/b&gt;,&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Sqr&lt;/b&gt;,&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Abs&lt;/b&gt;,&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Exp&lt;/b&gt;,&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Fix&lt;/b&gt;,&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Round&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;and&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Log.&lt;/b&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;a)&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Int&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;is the function that converts a number into an integer by truncating its decimal part and the resulting integer is the largest integer that is smaller than the number. For example, Int(2.4)=2, Int(4.8)=4, Int(-4.6)= -5, Int(0.032)=0 and so on.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;b)&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Sqr&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;is the function that computes the square root of a number. For example, Sqr(4)=2, Sqr(9)=2 and etc.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;c)&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Abs&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;is the function that returns the absolute value of a number. So Abs(-8) = 8 and Abs(8)= 8.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;d)&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Exp&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;of a number x is the value of e&lt;sup&gt;x&lt;/sup&gt;. For example, Exp(1)=e&lt;sup&gt;1&lt;/sup&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;= 2.7182818284590&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;e)&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Fix&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;and&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Int&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;are the same if the number is a positive number as both truncate the decimal part of the number and return an integer. However, when the number is negative, it will return the smallest integer that is larger than the number. For example, Fix(-6.34)= -6 while Int(-6.34)=-7.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;f)&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Round&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;is the function that rounds up a number to a certain number of decimal places. The Format is Round (n, m) which means to round a number n to m decimal places. For example, Round (7.2567, 2) =7.26&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;g)&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Log&lt;/b&gt;&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;is the function that returns the natural Logarithm of a number. For example,&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Log 10= 2.302585&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;h4 style="line-height: 18.0pt;"&gt;&lt;a href="" name="_Toc123994227"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Example 3&lt;/span&gt;&lt;/a&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h4&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;This example computes the values of Int(x), Fix(x) and Round(x,n) in a table form. It uses the Do Loop statement and the Rnd function to generate 10 numbers. The statement x = Round (Rnd * 7, 7) rounds a random number between 0 and 7 to 7 decimal places. Using commas in between items will create spaces between them and hence a table of values can be created. The program&amp;nbsp; and output are shown below&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;&amp;nbsp;Private Sub Form_Activate ()&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;n = 1&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Print " n", "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x", "Int(x)", "Fix(x)", "Round(x, 4)"&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Do While n &amp;lt; 11&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Randomize Timer&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;x = Round (Rnd * 7, 7)&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Print n, x, Int(x), Fix(x), Round(x, 4)&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;n = n + 1&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 3.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 7.5pt;"&gt;&lt;st1:place w:st="on"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US;"&gt;Loop&lt;/span&gt;&lt;/st1:place&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Angsana New&amp;quot;; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;End Sub&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_IQNllxJ00oI/SqZhk0UY4jI/AAAAAAAAAM4/E2wOt9t6jME/s1600-h/figure+11.3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_IQNllxJ00oI/SqZhk0UY4jI/AAAAAAAAAM4/E2wOt9t6jME/s400/figure+11.3.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-7015275863678683112?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/7015275863678683112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/09/lesson-11-mathematical-functions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7015275863678683112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7015275863678683112'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/09/lesson-11-mathematical-functions.html' title='Lesson 11: Mathematical Functions'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_IQNllxJ00oI/SqZhaDHXI1I/AAAAAAAAAMo/uDWU1KRcCuk/s72-c/figure+11.1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-8407538305863693767</id><published>2009-08-29T08:33:00.000-07:00</published><updated>2009-08-31T00:18:56.596-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Lesson 10'/><title type='text'>Lesson 10</title><content type='html'>&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="font-size: 18pt;"&gt;&amp;nbsp;Lesson 10: Introduction to VB Built-in Functions&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="font-size: 18pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;A function is similar to a normal procedure but the main purpose of the function is to accept a certain input from the user and return a value which is passed on to the main program to finish the execution. There are two types of functions, the built-in functions (or internal functions) and the functions created by the programmers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10pt;"&gt;the general format of a function is&lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&lt;b&gt;              FunctionName (arguments)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10pt;"&gt; The arguments are values that are passed on to the function.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;In this lesson, we are going to learn two very basic but useful internal functions of Visual basic , i.e.  the&lt;b&gt;MsgBox( )&lt;/b&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;and&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt; &lt;/span&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;InputBox ( )&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;functions.&lt;/span&gt;&lt;span style="color: black; font-family: Verdana;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;You can also learn about&lt;b&gt;mathematical functions, formatting functions&lt;/b&gt;&lt;/span&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;and&lt;b&gt;  string manipulation functions&lt;/b&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;by clicking the links at the end of this page.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;h3&gt;&lt;span style="color: black; font-family: Verdana; font-size: 14pt;"&gt;10.1 MsgBox ( ) Function&lt;/span&gt;&lt;span style="color: black; font-size: 14pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;The objective of MsgBox is to produce a pop-up message box and prompt the user to click on a command button before he /she can continues. This  format is as follows:&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;        &lt;b&gt;  yourMsg=MsgBox(Prompt, Style Value, Title) &lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt; The first argument, Prompt, will display the message in the message box. The Style Value  will determine what type of command buttons appear on the message box, please refer Table 10.1 for types of command button displayed. The Title argument will display the title of the message board.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Table 10.1: Style Values&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;table border="0" cellpadding="0" class="MsoNormalTable" style="mso-cellspacing: 1.5pt; width: 90.0%;"&gt;&lt;tbody&gt;&lt;tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0;"&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt; width: 20.0%;" width="20%"&gt;&lt;div align="center" class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: center;"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Style Value&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Named Constant&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Buttons Displayed&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 1;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;0&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbOkOnly&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Ok button&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 2;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;1&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbOkCancel&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Ok and Cancel buttons&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 3;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;2&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbAbortRetryIgnore&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Abort, Retry and Ignore buttons.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 4;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;3&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbYesNoCancel&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Yes, No and Cancel buttons&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 5;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;4&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbYesNo&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Yes and No buttons&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 6; mso-yfti-lastrow: yes;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;5&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbRetryCancel&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Retry and Cancel buttons&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 18.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;We can use named constant in place of integers for the second argument to make the programs more readable. In fact, VB6 will automatically shows up a list of names constant  where you can select one of them.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;        Example: yourMsg=MsgBox( "Click OK to Proceed", 1, "Startup Menu")&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;             and yourMsg=Msg("Click OK to Proceed". vbOkCancel,"Startup Menu")&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;are the same.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt; yourMsg is a variable that holds values that are returned by the MsgBox ( ) function. The values are determined by the type of buttons being clicked by the users. It has to be declared as Integer data type in the procedure or in the general declaration section.&lt;b&gt;Table 10.2 &lt;/b&gt;shows the values, the corresponding named constant and buttons.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Table 10.2 : Return Values and Command Buttons&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;table border="0" cellpadding="0" class="MsoNormalTable" style="mso-cellspacing: 1.5pt; width: 68.04%;"&gt;&lt;tbody&gt;&lt;tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0;"&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt; width: 18.68%;" width="18%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt; Value&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt; width: 43.32%;" width="43%"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Named Constant&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt; width: 35.9%;" width="35%"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Button Clicked &lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 1;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 18.68%;" width="18%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;1&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 43.32%;" width="43%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbOk&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 35.9%;" width="35%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Ok button&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 2;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 18.68%;" width="18%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;2&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 43.32%;" width="43%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbCancel&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 35.9%;" width="35%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Cancel button&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 3;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 18.68%;" width="18%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;3&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 43.32%;" width="43%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbAbort&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 35.9%;" width="35%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Abort button&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 4;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 18.68%;" width="18%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;4&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 43.32%;" width="43%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbRetry&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 35.9%;" width="35%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Retry button&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 5;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 18.68%;" width="18%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;5&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 43.32%;" width="43%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbIgnore&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 35.9%;" width="35%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Ignore button&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 6;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 18.68%;" width="18%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;6&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 43.32%;" width="43%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbYes&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 35.9%;" width="35%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Yes button&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 7; mso-yfti-lastrow: yes;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 18.68%;" width="18%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;7&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 43.32%;" width="43%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbNo&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt; width: 35.9%;" width="35%"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;No button&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Example 10.1&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;i. The Interface:&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;   You draw three command buttons and a label as shown in Figure 10.1&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Figure 10.1&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_IQNllxJ00oI/Spt2V91aemI/AAAAAAAAAMA/s4mz1duZ1VY/s1600-h/figure+10.1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_IQNllxJ00oI/Spt2V91aemI/AAAAAAAAAMA/s4mz1duZ1VY/s320/figure+10.1.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: black; font-size: 12pt;"&gt;ii. The procedure for the test button:&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;Private Sub Test_Click()&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;Dim&lt;/span&gt;&lt;span style="color: #3333ff; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;testmsg&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;As&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Integer&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;testmsg = MsgBox("Click to test", 1, "Test message")&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;If&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;testmsg = 1&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;Then&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Display.Caption = "Testing Successful"&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;Else&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Display.Caption = "Testing fail"&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;End If&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: #3333ff; font-family: Verdana; font-size: 10pt;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: 1.5pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;When a user click on the test button, the image like the one shown in Figure 10.2 will appear. As the user click on the OK button, the message "Testing successful" will be displayed and when he/she clicks on the Cancel button, the message "Testing fail" will be displayed.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Figure 10.2&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_IQNllxJ00oI/Spt3XUC9IfI/AAAAAAAAAMI/AyqZSmyUWyY/s1600-h/figure+10.2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_IQNllxJ00oI/Spt3XUC9IfI/AAAAAAAAAMI/AyqZSmyUWyY/s320/figure+10.2.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: black; font-size: 12pt;"&gt;To make the message box looks more sophisticated, you can add an icon besides the message. There are four types of icons available in VB as shown in  Table 10.3&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Table 10.3&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;table border="0" cellpadding="0" class="MsoNormalTable" style="mso-cellspacing: 1.5pt; width: 64.0%;"&gt;&lt;tbody&gt;&lt;tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0;"&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt; width: 20.0%;" width="20%"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Value&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Named Constant&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFCC99; padding: .75pt .75pt .75pt .75pt; width: 31.0%;" width="31%"&gt;&lt;div align="center" class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: center;"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Icon &lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 1;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;16&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbCritical&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;img height="41" shapes="_x0000_i1029" src="file:///C:/DOCUME~1/rutinku/LOCALS~1/Temp/msohtml1/01/clip_image003.jpg" width="39" /&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 2;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;32&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbQuestion&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;img height="38" shapes="_x0000_i1030" src="file:///C:/DOCUME~1/rutinku/LOCALS~1/Temp/msohtml1/01/clip_image005.jpg" width="41" /&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 3;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;48&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbExclamation&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;img height="41" shapes="_x0000_i1031" src="file:///C:/DOCUME~1/rutinku/LOCALS~1/Temp/msohtml1/01/clip_image007.jpg" width="39" /&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 4; mso-yfti-lastrow: yes;"&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;64&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div class="MsoNormal"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;vbInformation&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="background: #FFFFCC; padding: .75pt .75pt .75pt .75pt;"&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;&lt;img height="41" shapes="_x0000_i1032" src="file:///C:/DOCUME~1/rutinku/LOCALS~1/Temp/msohtml1/01/clip_image008.jpg" width="40" /&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;div align="center" class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: center;"&gt;&lt;span style="color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center" class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: center;"&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center" class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-align: center;"&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: black; font-size: 12pt;"&gt;Example 10.2&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;You draw the same Interface as in example 10.1 but modify the codes as follows:&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Private Sub test2_Click()&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Dim testMsg2 As Integer&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;testMsg2 = MsgBox("Click to Test", vbYesNoCancel + vbExclamation, "Test Message")&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;If testMsg2 = 6 Then&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;display2.Caption = "Testing successful"&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;ElseIf testMsg2 = 7 Then&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;display2.Caption = "Are you sure?"&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Else&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;display2.Caption = "Testing fail"&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;End If&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;In this example, the following message box will be displayed:&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Figure 10.3&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_IQNllxJ00oI/Spt3zTD64XI/AAAAAAAAAMQ/KqsZ6YYot1Y/s1600-h/figure+10.3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_IQNllxJ00oI/Spt3zTD64XI/AAAAAAAAAMQ/KqsZ6YYot1Y/s320/figure+10.3.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 14pt;"&gt;10.2 The InputBox( ) Function&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 14pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;span style="color: black; font-size: 12pt;"&gt;An InputBox( ) function will display a message box where the user can enter a value or a message in the form of text. The format is  &lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;myMessage=InputBox(Prompt, Title, default_text, x-position, y-position)&lt;/span&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;myMessage is a variant data type but typically it is declared as string, which accept the message input by the users. The arguments are explained as follows:&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul type="disc"&gt;&lt;li class="MsoNormal" style="mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0ptcolor:black;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Prompt            - The message displayed normally as a question asked.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0ptcolor:black;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;Title                 - The title of the Input Box.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0ptcolor:black;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;default-text       - The default text that appears in the input field where users can use it      as his intended input or he may change to the message he wish to key in.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="mso-list: l0 level1 lfo1; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; tab-stops: list 36.0ptcolor:black;"&gt;&lt;span style="font-family: Verdana; font-size: 10pt;"&gt;x-position      and y-position - the position or the coordinate of the input box.&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Example 10.3&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;i.  The Interface&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: center;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Figure 10.4&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_IQNllxJ00oI/Spt34NbJ-bI/AAAAAAAAAMY/8QlavbK4IT8/s1600-h/figure+10.4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_IQNllxJ00oI/Spt34NbJ-bI/AAAAAAAAAMY/8QlavbK4IT8/s320/figure+10.4.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: 16px; font-weight: normal;"&gt;ii. The procedure for the OK button&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Private Sub OK_Click()&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;Dim userMsg As String&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;userMsg = InputBox("What is your message?", "Message Entry Form", "Enter your messge here", 500, 700)&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;If userMsg &amp;lt;&amp;gt; "" Then&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;message.Caption = userMsg&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;Else&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;message.Caption = "No Message"&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;&lt;br /&gt;End If&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10pt;"&gt;When a user click the OK button, the input box as shown in Figure 10.5 will appear. After user entering the message and click OK, the message will be displayed on the caption, if he click Cancel, "No message" will be displayed.&lt;/span&gt;&lt;span style="color: black; font-size: 12pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_IQNllxJ00oI/Spt4DQAfOfI/AAAAAAAAAMg/VISqPZEqIe4/s1600-h/figure+10.5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_IQNllxJ00oI/Spt4DQAfOfI/AAAAAAAAAMg/VISqPZEqIe4/s320/figure+10.5.JPG" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Verdana; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="color: black;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-8407538305863693767?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/8407538305863693767/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/08/lesson-10.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/8407538305863693767'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/8407538305863693767'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/08/lesson-10.html' title='Lesson 10'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_IQNllxJ00oI/Spt2V91aemI/AAAAAAAAAMA/s4mz1duZ1VY/s72-c/figure+10.1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-6299470297471436851</id><published>2009-08-05T06:49:00.000-07:00</published><updated>2009-08-05T07:05:23.298-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 9'/><title type='text'>Lesson 9: Looping</title><content type='html'>&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;span class="apple-style-span"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;Visual Basic allows a procedure to be repeated many times as long as the processor until a condition or a set of conditions is fulfilled. This is generally called&amp;nbsp;looping .&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="apple-style-span"&gt;&lt;span style="color: black; font-family: Arial; font-size: 10.0pt;"&gt;Looping is a very useful feature of Visual Basic because it makes repetitive works easier. There are&amp;nbsp; two kinds of loops in Visual Basic,&amp;nbsp; the Do...&lt;st1:place w:st="on"&gt;Loop&lt;/st1:place&gt;&amp;nbsp; and the For.......Next loop&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-family: Arial; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Arial; font-size: small;"&gt;&lt;h3 style="line-height: 14.25pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 12.0pt;"&gt;9.1&amp;nbsp; Do Loop&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;The formats are&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;a)&amp;nbsp;&amp;nbsp; Do While condition&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Block of one or more VB statements&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;st1:place w:st="on"&gt;Loop&lt;/st1:place&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;b)&amp;nbsp;&amp;nbsp; Do&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Block of one or more VB statements&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop While condition&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;c)&amp;nbsp;&amp;nbsp;&amp;nbsp; Do Until condition&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Block of one or more VB statements&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;st1:place w:st="on"&gt;Loop&lt;/st1:place&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;d)&amp;nbsp;&amp;nbsp;&amp;nbsp; Do&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Block of one or more VB statements&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop Until condition&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana;"&gt;9.2 Exiting the &lt;st1:place w:st="on"&gt;Loop&lt;/st1:place&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;Sometime we need exit to exit a loop prematurely because of a certain condition is fulfilled. The syntax to use is known as Exit Do. You can examine Example 9.2 for its usage.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;h3&gt;&lt;span style="color: black; font-family: Verdana; font-size: 12.0pt;"&gt;9.3&amp;nbsp; For....Next &lt;st1:place w:st="on"&gt;Loop&lt;/st1:place&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;The format is:&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: #000099; font-family: Verdana; font-size: 10.0pt;"&gt;For&lt;/span&gt;&lt;span class="apple-converted-space"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;counter=startNumber to endNumber (Step increment)&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; One or more VB statements&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: #000099; font-family: Verdana; font-size: 10.0pt;"&gt;Next&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt;"&gt;Please refer to example 9.3a,9.3b and 9.3 c for its usage.&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-GB; mso-bidi-font-family: &amp;quot;Angsana New&amp;quot;; mso-bidi-language: TH; mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-language: EN-GB;"&gt;Sometimes the user might want to get out from the loop before the whole repetitive process is executed, the command to use is&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Exit For&lt;/b&gt;. To exit a For….Next Loop, you can place the&lt;span class="apple-converted-space"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;Exit For&lt;/b&gt;statement within the loop; and it is normally used together with the If…..Then… statement. Let’s examine example 9.3 d.&lt;/span&gt;&lt;br /&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="font-family: Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="font-family: Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="font-family: Verdana;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-family: Verdana;"&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example 9.1&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do while counter &amp;lt;=1000&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num.Text=counter&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter =counter+1&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;st1:place w:st="on"&gt;Loop&lt;/st1:place&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;* The above example will keep on adding until counter &amp;gt;1000.&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;The above example can be rewritten as&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; num.Text=counter&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter=counter+1&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Loop until counter&amp;gt;1000&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;b&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example 9.2&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Dim sum, n As Integer&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;Private Sub Form_Activate()&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;List1.AddItem "n" &amp;amp; vbTab &amp;amp; "sum"&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Do&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp; n = n + 1&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp; Sum = Sum + n&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;List1.AddItem n &amp;amp; vbTab &amp;amp; Sum&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;If n = 100 Then&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;Exit Do&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;End If&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp; &lt;st1:place w:st="on"&gt;Loop&lt;/st1:place&gt;&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End Sub&lt;/span&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 30.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 30.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;b&gt;&lt;i&gt;&lt;u&gt;&lt;span lang="EN-US" style="color: black; font-family: Verdana; font-size: 10.0pt; mso-ansi-language: EN-US; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Explanation&lt;/span&gt;&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 30.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;i&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;In the above&amp;nbsp; example, we&amp;nbsp;compute the summation of 1+2+3+4+……+100.&amp;nbsp; In the design stage, you need to insert a ListBox into the form for displaying the output, named List1. The program uses the AddItem method to populate the ListBox. The statement List1.AddItem "n" &amp;amp; vbTab &amp;amp; "sum" will display the headings in the ListBox, where it uses the vbTab function to create a space between the headings n and sum.&lt;/span&gt;&lt;/i&gt;&lt;span style="color: black; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 36.0pt; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="mso-cellspacing: 0cm; mso-padding-alt: 0cm 0cm 0cm 0cm; width: 100.0%;"&gt;&lt;tbody&gt;&lt;tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0;"&gt;   &lt;td style="padding: 0cm 0cm 0cm 0cm;"&gt;   &lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example   9.3 a&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;For&amp;nbsp;   counter=1 to 10&amp;nbsp;&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;display.Text=counter&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;   Next&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="padding: 0cm 0cm 0cm 0cm;"&gt;   &lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example   9.3 b&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;For   counter=1 to 1000 step 10&lt;/span&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;; mso-bidi-font-size: 12.0pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;counter=counter+1&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&lt;span style="color: black;"&gt;Next&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;tr style="mso-yfti-irow: 1; mso-yfti-lastrow: yes;"&gt;   &lt;td style="padding: 0cm 0cm 0cm 0cm;" valign="top"&gt;   &lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;b&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example   9.3 c&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;   For counter=1000 to 5 step -5&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;   counter=counter-10&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="color: black; font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;   Next&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt; margin-left: 0cm; margin-right: 0cm; margin-top: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;*Notice that   increment can be negative&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style="padding: 0cm 0cm 0cm 0cm;"&gt;   &lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;b&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Example   9.3 d&lt;/span&gt;&lt;/b&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Private   Sub Form_Activate( )&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;For   n=1 to 10&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;If   n&amp;gt;6 then&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Exit   For&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End   If&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Else&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;Print   n&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End If&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; margin-bottom: .75pt;"&gt;&lt;span style="font-family: Verdana; font-size: 10.0pt; mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;End   Sub&lt;/span&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Times New Roman&amp;quot;;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="MsoNormal"&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-6299470297471436851?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/6299470297471436851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/08/lesson-9-looping.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/6299470297471436851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/6299470297471436851'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/08/lesson-9-looping.html' title='Lesson 9: Looping'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-1453589314533081008</id><published>2009-07-10T02:15:00.000-07:00</published><updated>2009-07-10T05:42:28.116-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 8'/><title type='text'>Lesson 8 : Select Case....End select Control Structure</title><content type='html'>&lt;div class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="color:black;"&gt;In the previous lesson, we have learned how to control the program flow using the &lt;b&gt;If...ElseIf&lt;/b&gt; control structure. In this chapter, you will learn  another way to control the program flow, that is, the &lt;b&gt;Select Case&lt;/b&gt; control structure. However, the Select Case control structure is slightly different from the If....ElseIf control structure . The difference is that the Select Case control structure basically only make decision on one expression or dimension (for example the examination grade) while the If ...ElseIf statement control structure may evaluate only one expression, each If....ElseIf statement may also compute entirely different dimensions. Select Case is preferred when there exist many different conditions because using If...Then..ElseIf statements might become too messy.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; mso-margin-bottom-alt: auto; text-align: justify;"&gt;&lt;span style="color:black;"&gt;The format of the Select Case control structure is show below:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; mso-margin-bottom-alt: auto; text-align: justify;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; mso-margin-bottom-alt: auto; text-align: justify;"&gt;&lt;/div&gt;&lt;div class="MsoNormal" style="line-height: 12.0pt; mso-margin-bottom-alt: auto; text-align: justify;"&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:14pt;color:#000099;"&gt;Select Case &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt;expression&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt;   &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:#000099;"&gt;Case&lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt; &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt;value1&lt;br /&gt;        Block of one or more VB statements&lt;br /&gt;  &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:#000099;"&gt; &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:#000099;"&gt;Case&lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt; &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt;value2&lt;br /&gt;        Block of one or more VB Statements&lt;br /&gt;   &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:#000099;"&gt;Case&lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt; &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt;value3&lt;br /&gt;            .&lt;br /&gt;        .&lt;br /&gt;  &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:#000099;"&gt; &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:#000099;"&gt;Case&lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt; &lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt;Else&lt;br /&gt;        Block of one or more VB Statements&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:14pt;color:#000099;"&gt;End Select&lt;/span&gt;&lt;span style=" ;font-size:14pt;color:black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;span style="font-size:19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;span style="font-size:19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;span style="font-size:19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;span style="font-size:19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;span style="font-size:19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;span style="font-size:19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;span style="font-size:19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-top: 0cm; mso-line-height-alt: 12.0pt;"&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;span style="font-size:19px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-size:x-large;color:#000099;"&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;b&gt;Example 8.1&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Dim grade As String&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Private Sub Compute_Click( )&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;grade=txtgrade.Text&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-size:medium;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Select Case grade&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;  Case  "A"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;       result.Caption="High  Distinction"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-size:medium;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;  Case "A-"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;      result.Caption="Distinction"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-size:medium;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;  Case "B"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;         result.Caption="Credit"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-size:medium;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;  Case "C"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;        result.Caption="Pass"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-size:medium;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;  Case Else&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;        result.Caption="Fail"&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=" ;font-size:medium;color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;  End Select&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-top: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;End Sub&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;b&gt;&lt;span style="color:black;"&gt;Example 8.2&lt;/span&gt;&lt;/b&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Dim mark As Single&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;Private Sub Compute_Click()&lt;br /&gt;'Examination Marks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt; mark = mrk.Text&lt;br /&gt;&lt;br /&gt;Select Case mark&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt; Case Is &amp;gt;= 85&lt;br /&gt;&lt;br /&gt;     comment.Caption = "Excellence"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Case Is &amp;gt;= 70&lt;br /&gt;&lt;br /&gt;    comment.Caption = "Good"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Case Is &amp;gt;= 60&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;   comment.Caption = "Above Average"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Case Is &amp;gt;= 50&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;comment.Caption = "Average"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Case Else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;comment.Caption = "Need to work harder"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;End Select&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;b&gt;&lt;span style="color:black;"&gt;Example 8.3&lt;/span&gt;&lt;/b&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Example 8.2 could be rewritten  as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Dim mark As Single&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;Private Sub Compute_Click()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;'Examination Marks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt; mark = mrk.Text&lt;br /&gt;&lt;br /&gt;Select Case mark&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt; Case 0 to 49&lt;br /&gt;&lt;br /&gt;     comment.Caption = "Need to work harder"&lt;br /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Case 50 to 59&lt;br /&gt;&lt;br /&gt;    comment.Caption = "Average"&lt;br /&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Case 60 to 69&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;   comment.Caption = "Above Average"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Case 70 to 84&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;comment.Caption = "Good"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;Case Else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;comment.Caption = "Excellence"&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;End Select&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;span style="color:black;"&gt;End Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="line-height: 12.0pt; margin-bottom: .0001pt; margin: 0cm;"&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-1453589314533081008?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/1453589314533081008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/07/lesson-8-select-caseend-select-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/1453589314533081008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/1453589314533081008'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/07/lesson-8-select-caseend-select-control.html' title='Lesson 8 : Select Case....End select Control Structure'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-6999333054309848364</id><published>2009-05-31T06:09:00.001-07:00</published><updated>2009-05-31T06:19:42.291-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 7'/><title type='text'>Lesson 7. Controling Program Flow</title><content type='html'>In previous lessons, we have learned how to create Visual Basic code that can  accept input from the user and display the output without controlling the program flow. In this chapter, you will learn how to crreate VB code that can make decision when it process input from the user, and control the program flow in the process. Decision making process is an important part of programming because it can help to solve practical problems intelligently so that it can provide useful output or feedback to the user. For example, we can write a  program that can ask the computer to perform certain task until a certain condition is met.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;7.1  Conditional Operators&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;To control the VB program flow, we can use various conditional operators. Basically, they resemble mathematical  operators. Conditional operators are very powerful tools, they let the VB program compare data values and then decide what action to take, whether to execute a program or terminate the program and more. These operators are shown in Table 7.1.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;strong&gt;Table 7.1: Conditional Operators&lt;/strong&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 324px; height: 144px;" src="http://2.bp.blogspot.com/_IQNllxJ00oI/SiKCVaL89xI/AAAAAAAAAIw/w-ld4YrXoOY/s400/table+7.1.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5341975412333147922" /&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;strong&gt;7.2  Logical Operators&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In addition to conditional operators, there are a few logical operators which offer added power to the VB programs. There are shown in Table 7.2.&lt;/p&gt;&lt;p align="center"&gt;&lt;br /&gt;&lt;br /&gt;Table 7.2&lt;br /&gt;&lt;img style="cursor:pointer; cursor:hand;width: 137px; height: 277px;" src="http://2.bp.blogspot.com/_IQNllxJ00oI/SiKDFwpOjSI/AAAAAAAAAI4/yXdGioEkIYQ/s400/table+7.2.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5341976242995236130" /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="fullpost"&gt;* You can also compare strings with the above operators. However, there are certain rules to follows: Upper case letters are less than lowercase letters, "A"&lt;"B"&lt;"C"&lt;"D".......&lt;"Z" and number are less than letters.  &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;7.3  Using  If.....Then.....Else  Statements  with Operators&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;To effectively control the VB program flow, we shall use If...Then...Else statement together with the conditional operators and logical operators. &lt;br /&gt;The general format for the if...then...else statement is&lt;br /&gt;&lt;br /&gt;If  conditions Then&lt;br /&gt;VB expressions&lt;br /&gt;Else&lt;br /&gt;VB expressions&lt;br /&gt;End If&lt;br /&gt;* any If..Then..Else statement must end with End If. Sometime it is not necessary to use Else.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;          Private Sub OK_Click()&lt;br /&gt;&lt;br /&gt;              firstnum = Val(usernum1.Text)&lt;br /&gt;              secondnum = Val(usernum2.Text)&lt;br /&gt;              total = Val(sum.Text) &lt;br /&gt;                           If total = firstnum + secondnum And Val(sum.Text) &lt;&gt; 0 Then &lt;br /&gt;              correct.Visible = True &lt;br /&gt;              wrong.Visible = False &lt;br /&gt;                        Else &lt;br /&gt;              correct.Visible = False &lt;br /&gt;              wrong.Visible = True &lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;           End Sub&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-6999333054309848364?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/6999333054309848364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-7-controling-program-flow.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/6999333054309848364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/6999333054309848364'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-7-controling-program-flow.html' title='Lesson 7. Controling Program Flow'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_IQNllxJ00oI/SiKCVaL89xI/AAAAAAAAAIw/w-ld4YrXoOY/s72-c/table+7.1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-4655277977491072799</id><published>2009-05-31T05:28:00.000-07:00</published><updated>2009-05-31T06:06:22.719-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 6'/><title type='text'>Lesson 6. Working With Variables</title><content type='html'>&lt;div align="justify"&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;6.1 Assigning Values to Variables&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt;After declaring various variables using the Dim statements, we can assign values to those variables. The general format of an assignment is Variable=Expression The variable can be a declared variable or a control property value. The expression could be a mathematical expression, a number, a string, a Boolean value (true or false) and more. The following are some examples:&lt;div align="justify"&gt;&lt;br /&gt;firstNumber             =100 &lt;br /&gt;secondNumber         =firstNumber-99 &lt;br /&gt;userName                 ="John Lyan" &lt;br /&gt;userpass.Text          = password &lt;br /&gt;Label1.Visible           = True &lt;br /&gt;Command1.Visible   = false &lt;br /&gt;Label4.Caption         = textbox1.Text &lt;br /&gt;ThirdNumber           = Val(usernum1.Text) &lt;br /&gt;total = firstNumber + secondNumber+ThirdNumber&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;p align="justify"&gt;&lt;strong&gt;Example 6.1&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt; &lt;br /&gt;Dim firstName As String&lt;br /&gt;Dim secondName As String&lt;br /&gt;Dim yourName As String&lt;br /&gt; &lt;br /&gt;         Private Sub Command1_Click()&lt;br /&gt;                firstName = Text1.Text&lt;br /&gt;                secondName = Text2.Text&lt;br /&gt;                yourName = secondName + "  " + firstName&lt;br /&gt;                        Label1.Caption = yourName&lt;br /&gt;        End Sub&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span class="fullpost"&gt;In this example, three variables are declared as string. For variables firstName and secondName will receive their data from the user’s input into textbox1 and textbox2, and the variable yourName will be assigned the data by combining the first two variables.  Finally, yourName is displayed on Label1.&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span class="fullpost"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span class="fullpost"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span class="fullpost"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span class="fullpost"&gt;&lt;strong&gt;6.2 Operators in Visual Basic&lt;/strong&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span class="fullpost"&gt;&lt;span class="fullpost"&gt;To compute inputs from users and to generate results, we need to use various mathematical operators. In Visual Basic, except for + and -, the symbols for the operators are different from normal mathematical operators, as shown in Table 6.1.&lt;/span&gt;&lt;div align="justify"&gt;&lt;span class="fullpost"&gt;&lt;span class="fullpost"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;span class="fullpost"&gt;&lt;span class="fullpost"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;span class="fullpost"&gt;&lt;span class="fullpost"&gt;Table 6.1: Arithmetic Operators&lt;/span&gt;&lt;/span&gt;&lt;span class="fullpost"&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="center"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 400px; height: 251px;" src="http://4.bp.blogspot.com/_IQNllxJ00oI/SiJ-yzWEexI/AAAAAAAAAIg/81rTlS5yBg0/s400/table+6.1.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5341971519256165138" /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;strong&gt;Example 6.2&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;   Dim number1, number2, number3 as Integer&lt;br /&gt;   Dim total, average as variant&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;          Private sub Form_Click()&lt;br /&gt;                  number1=val(Text1.Text) &lt;br /&gt;                  number2=val(Text2.Text) &lt;br /&gt;                  number3= val(Text3.Text)&lt;br /&gt;                 Total=number1+number2+number3&lt;br /&gt;                 Average=Total/5&lt;br /&gt;                 Label1.Caption=Total&lt;br /&gt;                 Label2.Caption=Average&lt;br /&gt;         End Sub&lt;/div&gt;&lt;div align="justify"&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;br /&gt;In the example above, three variables are declared as integer and two variables are declared as variant. Variant means the variable can hold any data type. The program computes the total and average of the three numbers that are entered into three text boxes.&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-4655277977491072799?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/4655277977491072799/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/4655277977491072799'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/4655277977491072799'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/6.html' title='Lesson 6. Working With Variables'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_IQNllxJ00oI/SiJ-yzWEexI/AAAAAAAAAIg/81rTlS5yBg0/s72-c/table+6.1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-2447390444465847447</id><published>2009-05-17T20:15:00.000-07:00</published><updated>2009-05-30T18:19:53.462-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 5'/><title type='text'>Lesson 5. Managing Visual Basic Data</title><content type='html'>&lt;span class="Apple-style-span"  style=" -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family:Verdana;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;T&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;here are many types of data that we come across in our daily life. For example, we need to handle data such as names, addresses, money, date, stock quotes, statistics and more everyday. Similarly in Visual Basic, we have to deal with all sorts of  of data, some can be mathematically calculated while some are in the form of text or other forms. VB divides data into different types so that it is easier to manage when we need to write the code involving those data.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;p&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5.1 Visual Basic Data Types&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Visual Basic classifies the information mentioned above into two major data types, they are the numeric data types and the non-numeric data types.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style=" ;font-family:Verdana;font-size:11pt;"&gt;&lt;p&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5.1.1 Numeric Data&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Types&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style=" font-weight: normal; line-height: 19px; -webkit-border-horizontal-spacing: 3px; -webkit-border-vertical-spacing: 3px; "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Numeric data types are types of data that consist of numbers, which can be computed mathematically with various standard operators such as add, minus, multiply, divide and more. Examples of numeric data types are examination marks, height, weight, the number of students in a class, share values, price of goods, monthly bills, fees and others. In Visual Basic, numeric data are divided into 7 types, depending on the range of values they can store. Calculations that only involve round figures or data that does not need precision can use Integer or Long integer in the computation. Programs that require high precision calculation need to use Single and Double decision data types, they are also called floating point numbers. For currency calculation , you can use the currency data types. Lastly, if even more precision is required to perform calculations that involve a many decimal points, we can use the decimal data types. These data types summarized in Table 5.1&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span"  style=" line-height: 19px; -webkit-border-horizontal-spacing: 3px; -webkit-border-vertical-spacing: 3px;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span"  style=" line-height: 19px; -webkit-border-horizontal-spacing: 3px; -webkit-border-vertical-spacing: 3px;font-size:13px;"&gt;&lt;span class="Apple-style-span"  style=" line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-size:16px;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;table border="0" width="100%" id="table4" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;p align="center"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;Table 5.1: Numeric Data Types&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;table class="MsoNormalTable" border="0" cellpadding="0" id="table5"   style="width: 95%; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 255, 204);   background-position: initial initial; font-family:'Times New Roman';font-size:10pt;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="8%" style="width: 8%; padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=" ;color:black;"&gt;Type&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="width: 10%; padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=" ;color:black;"&gt;Storage &lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;&lt;u&gt;&lt;span style=" ;color:black;"&gt;Range of Values&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="5%" style="width: 5%; padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Byte&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="width: 10%; padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;1 byte&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;0 to 255&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Integer&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;2 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;-32,768 to 32,767&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Long &lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;4 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;-2,147,483,648 to 2,147,483,648&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Single&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;4 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;-3.402823E+38 to -1.401298E-45 for negative values &lt;br /&gt;1.401298E-45 to 3.402823E+38 for positive values.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Double&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;8 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;-1.79769313486232e+308 to -4.94065645841247E-324 for negative values &lt;br /&gt;4.94065645841247E-324 to 1.79769313486232e+308 for positive values.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Currency&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;8 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;-922,337,203,685,477.5808 to 922,337,203,685,477.5807&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Decimal&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;12 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;+/- 79,228,162,514,264,337,593,543,950,335 if no decimal is use &lt;br /&gt;+/- 7.9228162514264337593543950335 (28 decimal places).&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt; &lt;/p&gt;&lt;/span&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;span style=" ;font-family:Verdana;font-size:11pt;"&gt;&lt;p align="center" style="text-align: left; "&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;      &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;p align="center" style="text-align: left; "&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;font-size:11pt;"&gt; &lt;/span&gt; &lt;span class="Apple-style-span" style="font-size: small;"&gt;5.1.2 Non-numeric Data Types&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span style=" ;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left; "&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Nonnumeric data types are data that cannot be manipulated mathematically using standard arithmetic operators. The non-numeric data comprises  text or string data types, the Date data types, the Boolean data types that store only two values (true or false), Object data type and Variant data type .They are summarized in Table 5.2&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;span class="Apple-style-span"  style=" ;font-size:16px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Table 5.2: Nonnumeric Data Types&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Verdana;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;table class="MsoNormalTable" border="0" cellpadding="0" id="table10"   style="width: 98%; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 255, 204);   background-position: initial initial; font-family:'Times New Roman';font-size:10pt;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="width: 32%; padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Data Type&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="width: 20%; padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Storage&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Range&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;String(fixed length)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Length of string&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;1 to 65,400 characters&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;String(variable length)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Length + 10 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;0 to 2 billion characters&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Date&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;8 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;January 1, 100 to December 31, 9999&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Boolean&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;2 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;True or False&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Object&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;4 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Any embedded object&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Variant(numeric)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;16 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Any value as large as Double&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Variant(text)&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Length+22 bytes&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Same as variable-length string&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span"   style="  ;font-family:Verdana;font-size:16px;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;p align="center" style="text-align: left; "&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5.1.3 Suffixes for Literals&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left; "&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Literals are values that you assign to data. In some cases, we need to add a suffix behind a literal so that VB can handle the calculation more accurately. For example, we can use num=1.3089# for a Double type data. Some of the suffixes are displayed in Table 5.3.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;Table 5.3&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;/span&gt;&lt;div align="center"&gt;&lt;table class="MsoNormalTable" border="0" cellpadding="0" width="50%" id="table7"   style="width: 50%; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 255, 204);   background-position: initial initial; font-family:'Times New Roman';font-size:10pt;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Suffix&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Data Type&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&amp;amp;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Long&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;!&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Single&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;#&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Double&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;@&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Currency&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;p&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;In addition, we need to enclose string literals within two quotations and date and time literals within two # sign. Strings can contain any characters, including numbers. The following are few examples:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;memberName="Turban, John."&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;TelNumber="1800-900-888-777"&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;LastDay=#31-Dec-00#&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;ExpTime=#12:00 am#&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span"  style="color: rgb(51, 51, 51);   line-height: 20px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; font-family:'times new roman';"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:Arial;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5.2 Managing Variables&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Variables are like mail boxes in the post office. The contents of the variables changes every now and then, just like the mail boxes. In term of VB, variables are areas allocated by the computer memory to hold data. Like the mail boxes, each variable must be given a name. To name a variable in Visual Basic, you have to follow a set of rules.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-family: Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5.2.1 Variable Names&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The following are the rules when naming the variables in Visual Basic&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul type="disc" style="margin-bottom: 0cm; "&gt;&lt;li class="MsoNormal"   style="margin-bottom: 0.0001pt;   margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:'Times New Roman';font-size:12pt;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;It must be less than 255 characters&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal"   style="margin-bottom: 0.0001pt;   margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:'Times New Roman';font-size:12pt;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;No spacing is allowed&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal"   style="margin-bottom: 0.0001pt;   margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:'Times New Roman';font-size:12pt;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;It must not  begin with a number&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal"   style="margin-bottom: 0.0001pt;   margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:'Times New Roman';font-size:12pt;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Period is not permitted&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Examples of valid and invalid variable names are displayed in Table 5.4&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;                                                  Table 5.4&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;table class="MsoNormalTable" border="0" cellpadding="0"   style="width: 50%; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 255, 204);   background-position: initial initial; font-family:'Times New Roman';font-size:10pt;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;Valid Name&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: rgb(255, 204, 153); background-position: initial initial; "&gt;&lt;p align="center" style="text-align: center; "&gt;&lt;span style="font-family:Verdana;"&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;Invalid Name&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;My_Car&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;My.Car &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;ThisYear&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;1NewBoy&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;Long_Name_Can_beUSE&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td style="padding-top: 0.75pt; padding-right: 0.75pt; padding-bottom: 0.75pt; padding-left: 0.75pt; "&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;He&amp;amp;HisFather                  *&amp;amp; is not acceptable&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-family: Verdana; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=" ;color:black;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5.2.2 Declaring Variables&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;In Visual Basic, one needs to declare the variables before using them by assigning names and data types. They are normally declared in the general section of the codes' windows using the &lt;/span&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim&lt;/span&gt;&lt;/b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; statement.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The format  is as follows:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Variable Name&lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; As &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Data Type&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Example 5.1&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim password As String&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim yourName As String&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim firstnum As Integer&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim secondnum As Integer&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim total As Integer&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim doDate As Date&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;You may also combine them in one line , separating each variable with a comma, as follows:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim password As String,  yourName As String, firstnum As Integer,.............&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;If data type is not specified, VB will automatically declare the variable as a Variant.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;For string declaration, there are two possible formats, one for the variable-length string and another for the fixed-length string. For the variable-length string, just use the same format as example 5.1 above. However, for the fixed-length string, you have to use the format as shown below:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;i&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim VariableName as String * n&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style=" ;color:black;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, where n defines the number of characters the string can hold.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Example 5.2:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Dim yourName as String * 10&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;yourName can holds no more than 10 Characters. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class="Apple-style-span" style="font-family: Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5.3 Constants&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Constants are different from variables in the sense that their values do not change during the running of the program.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Arial;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;5.3.1 Declaring a Constant&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;The format to declare a constant is&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Const  &lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Constant Name  &lt;/span&gt;&lt;/i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;As&lt;/span&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; Data Type = Value&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Example 5.3&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Const Pi As Single=3.142&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Const Temp As Single=37&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Const Score As Single=100&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=" ;font-family:Verdana;font-size:11pt;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-2447390444465847447?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/2447390444465847447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-5-managing-visual-basic-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/2447390444465847447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/2447390444465847447'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-5-managing-visual-basic-data.html' title='Lesson 5. Managing Visual Basic Data'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-7291442833634630303</id><published>2009-05-17T08:17:00.000-07:00</published><updated>2009-05-30T18:19:53.462-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 4'/><title type='text'>Lesson 4. Writing the Code</title><content type='html'>&lt;span class="Apple-style-span"  style=" ;font-family:'times new roman';"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=" ;font-family:Verdana;"&gt;I&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;n lesson 2, you have learned how to enter the program code and run the sample VB programs but without much understanding about the logics of VB programming. Now, let’s get down to learning some basic rules about writing the VB program code.&lt;/span&gt;&lt;p class="MsoNormal" align="left" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;   Each control or object in VB can usually run many kinds of events or procedures; these events are listed in the dropdown list in the code window  that is displayed when you double-click on an object and click on the procedures’ box(refer to Figure 2.3). Among the events are loading a form, clicking of a command button, pressing a key on the keyboard or dragging an object and more. For each event, you need to write an event procedure so that it can perform  an action or a series of actions&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="left" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style=" ;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="  line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family:'times new roman';font-size:16px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;To start writing an event procedure, you need to double-click an object. For example, if you want to write an event procedure when a user clicks   a command button, you double-click on the command button and an event procedure will appear as shown in Figure 2.1. It takes the following format: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style=" ;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="  line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family:'times new roman';font-size:16px;"&gt;&lt;h5   style="margin-bottom: 0.0001pt; line-height: 150%; page-break-after: avoid;   font-weight: bold; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:Arial;font-size:12pt;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Private Sub Command1_Click&lt;/span&gt;&lt;/h5&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;(Key in your program code here)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h5   style="margin-bottom: 0.0001pt; line-height: 150%; page-break-after: avoid;   font-weight: bold; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:Arial;font-size:12pt;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;End Sub&lt;/span&gt;&lt;/h5&gt;&lt;h5   style="margin-bottom: 0.0001pt; line-height: 150%; page-break-after: avoid;   font-weight: bold; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:Arial;font-size:12pt;"&gt;&lt;span class="Apple-style-span"   style=" ;font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h5&gt;&lt;h5   style="margin-bottom: 0.0001pt; line-height: 150%; page-break-after: avoid;   font-weight: bold; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:Arial;font-size:12pt;"&gt;&lt;span class="Apple-style-span"   style=" ;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="  font-weight: normal; line-height: normal; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; font-family:'times new roman';font-size:16px;"&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;You then need to key-in the procedure in the space between Private Sub Command1_Click............. End Sub.  Sub actually stands for sub procedure that made up a part of all the procedures in a program. The program code is made up of a number of statements that set certain properties or trigger some actions. The syntax of Visual Basic’s program code is almost like the normal English language though not exactly the same, so it is very easy to learn.  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;The syntax to set the property of an object or to pass certain value to it is :&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;                           &lt;b&gt; Object.Property &lt;br /&gt;&lt;/b&gt;where&lt;b&gt; Object&lt;/b&gt; and Property is separated by a period (or dot). For example, the statement &lt;b&gt;Form1.Show&lt;/b&gt;means to show the form with the name Form1, &lt;b&gt;Iabel1.Visible=true&lt;/b&gt; means label1 is set to be visible,&lt;b&gt;Text1.text=”VB”&lt;/b&gt; is to assign the text VB to the text box with the name Text1, Text2.text=100 is to pass a value of 100 to the text box with the name text2, &lt;b&gt;Timer1.Enabled=False&lt;/b&gt; is to disable the timer with the name Timer1 and so on. Let’s examine a few examples below:&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;Example 4.1 :&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Private Sub Command1_Click&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Label1.Visible = True&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Label2.Visible = False&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Text1.Ttext = "You're Correct!"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;End Sub&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;Example 4.2 :&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Private Sub Command1_Click&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Label1.Caption="Welcome"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Picture1.Visible=True&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;End Sub&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;Example 4.3 :&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Private Sub Command1_Click&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Picture1.Show=True&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Timer1.Enabled=True&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;  &lt;/span&gt;Label1.Caption="Start Counting"&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;End Sub&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="  font-weight: bold;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(51, 51, 51);   font-weight: normal; line-height: 20px; font-family:'times new roman';font-size:16px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;In Example 4.1, clicking on the command button will make label1 become invisible and label2 become visible; and the text” You are correct” will appear in TextBox1.  In example 4.2, clicking on the command button will make the caption label1 change to “Welcome” and Image1 will become visible.   In example 4.3 , clicking on the command button will make Picture1 show up, timer starts running and the caption of label1 change to “Start Counting”. &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt; Syntaxes that do not involve setting of properties are also English-like, some of the commands are &lt;b&gt;Print, If…Then….Else….End If, For…Next, Select Case…..End Select , End &lt;/b&gt;and&lt;b&gt; Exit Sub. &lt;/b&gt;For example, &lt;b&gt;Print  “ Visual Basic”&lt;/b&gt; is to display the text Visual Basic on screen and &lt;b&gt;End &lt;/b&gt;is to end the program. Other commands will be explained in details in the coming lessons.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;Program code that involve calculations is very easy to write, you need to write them almost like you do in mathematics. However, in order to write an event procedure that involves calculations, you need to know the basic arithmetic operators in VB as they are not exactly the same as the normal operators we use, except for &lt;b&gt;+&lt;/b&gt; and&lt;b&gt; - . &lt;/b&gt;For multiplication, we use &lt;b&gt;*&lt;/b&gt;, for division we use &lt;b&gt;/&lt;/b&gt;, for raising a number x to the power of n, we use &lt;b&gt;x ^n &lt;/b&gt;and for square root, we use &lt;b&gt;Sqr(x).&lt;/b&gt; VB offers many more advanced mathematical functions such as &lt;b&gt;Sin, &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;&lt;span style=" ;font-family:Verdana;"&gt;Cos, Tan&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt; and &lt;b&gt;Log, &lt;/b&gt;they will be discussed in lesson 10. There are also two important functions that are related to arithmetic operations, i.e. the functions &lt;b&gt;Val&lt;/b&gt; and &lt;b&gt;Str$&lt;/b&gt; where Val is to convert text entered into a textbox to numerical value and Str$ is to display a numerical value in a textbox as a string (text).  While the function Str$ is as important as VB can display a numeric values as string implicitly, failure to use Val will results in wrong calculation. Let’s examine example 4.4 and example 4.5.   &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span" style="line-height: 20px; "&gt;&lt;table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;h5   style="margin-bottom: 0.0001pt; line-height: 150%; page-break-after: avoid;   font-weight: bold; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:Arial;font-size:12pt;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Example 4.4&lt;/span&gt;&lt;/h5&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Form_Activate()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;  Text3.text=text1.text+text2.text&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;td&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Example 4.5&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Form_Activate()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;  Text3.text=val(text1.text)+val(text2.text)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;color:#0000FF;"&gt;End Sub &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;When you run the program in example 4.4 and enter 12 in textbox1 and 3 in textbox2 will give you a result of 123, which is wrong. It is because VB treat the numbers as string and so it just joins up the two strings. On the other hand, running exampled 4.5 will give you the correct result, i.e., 15.  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;/h5&gt;&lt;p&gt;&lt;/p&gt;&lt;h5 face="Arial" size="12pt" style="margin-bottom: 0.0001pt; line-height: 150%; page-break-after: avoid;   font-weight: bold; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; "&gt;&lt;p&gt;&lt;/p&gt;&lt;/h5&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-7291442833634630303?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/7291442833634630303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7291442833634630303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7291442833634630303'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-4.html' title='Lesson 4. Writing the Code'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-7666739415764753490</id><published>2009-05-17T08:11:00.000-07:00</published><updated>2009-05-30T18:19:53.463-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson 3'/><title type='text'>Lesson 3. Working With Controls</title><content type='html'>&lt;span class="Apple-style-span"   style="border-collapse: collapse;   font-family:'Times New Roman';font-size:13px;"&gt;&lt;p style="line-height: 150%; "&gt;&lt;span style=" font-weight: 700; font-family:Verdana;"&gt;&lt;span style="font-size:100%;"&gt;3.1 The Control Properties&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Before writing an event procedure for the control to response to a user's input, you have to set certain properties for the control to determine its appearance and how it will work with the event procedure. You can set the properties of the controls in the properties window or at runtime.&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"  style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="border-collapse: separate; line-height: normal; "&gt;Figure 3.1 on the right is a typical properties window for a form. You can rename the form caption to any name that you like best. In the properties window, the item appears at the top part is the object currently selected (in Figure 3.1, the object selected is Form1). At the bottom part, the items listed in the left column represent the names of various properties associated with the selected object while the items listed in the right column represent the states of the properties. Properties can be set by highlighting the items in the right column then change them by typing or selecting the options available.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"  style="border-collapse: separate;  line-height: normal;font-family:Verdana;"&gt;&lt;span class="Apple-style-span"  style="border-collapse: collapse;  font-family:'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;For example, in order to change the caption, just highlight Form1 under the name Caption and change it to other names. You may also try to alter the appearance of the form by setting it to 3D or flat. Other things you can do are to change its foreground and background color, change the font type and font size, enable or disable minimize and maximize buttons and etc.&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You can also change the properties at runtime to give special effects such as change of color, shape, animation effect and so on. For example the following code will change the form color to red every time the form is loaded. VB uses hexadecimal system to represent the color. You can check the color codes in the properties windows which are showed up under ForeColor and BackColor .&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"  style="font-family:Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"  style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span"  style=" line-height: normal; font-family:'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub &lt;/span&gt;Form_Load()&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Form1.Show&lt;br /&gt;Form1.BackColor = &amp;amp;H000000FF&amp;amp;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="color: rgb(0, 0, 255); font-family:Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="color: rgb(0, 0, 255); font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); line-height: 19px; "&gt;Another example is to change the control Shape to a particular shape at runtime by writing the following code. This code will change the shape to a circle at runtime. Later you will learn how to change the shapes randomly by using the &lt;b&gt;RND&lt;/b&gt; function.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style=" line-height: 19px;font-family:Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style=" line-height: 19px;font-family:Verdana;"&gt;&lt;span class="Apple-style-span"  style=" line-height: normal; font-family:'Times New Roman';"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Form_Load()&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Shape1.Shape = 3&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="color: rgb(0, 0, 255); font-family:Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="color: rgb(0, 0, 255); font-family:Verdana;"&gt;&lt;span class="Apple-style-span"   style="border-collapse: separate; color: rgb(51, 51, 51);   line-height: 20px; font-family:'times new roman';font-size:16px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p style="line-height: 150%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;I&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt; would like to stress that knowing how and when to set the objects' properties is very important as it can help you to write a good program or you may fail to write a good program. So, I advice you to spend a lot of time playing with the objects' properties.&lt;/span&gt;&lt;/p&gt;&lt;p style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;I am not going into the details on how to set the properties. However, I would like to stress a few important points about setting up the properties.&lt;/span&gt;&lt;/p&gt;&lt;div align="center"&gt;&lt;table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;ul type="disc" style="margin-bottom: 0cm; "&gt;&lt;li class="MsoNormal"   style="line-height: 150%; margin-bottom: 0.0001pt;   margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:'Times New Roman';font-size:12pt;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You should set the Caption Property of a control clearly so that a user knows what to do with that command. For example, in the calculator program, all the captions of the command buttons such as +, - , MC, MR are commonly found in an ordinary calculator, a user should have no problem in manipulating the buttons.&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal"   style="line-height: 150%; margin-bottom: 0.0001pt;   margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:'Times New Roman';font-size:12pt;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;A lot of programmers like to use a meaningful name for the Name Property may be because it is easier for them to write and read the event procedure and easier to debug or modify the programs later. However, it is not a must to do that as long as you label your objects clearly and use comments in the program whenever you feel necessary. T&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal"   style="line-height: 150%; margin-bottom: 0.0001pt;   margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:'Times New Roman';font-size:12pt;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;One more important property is whether the control is enabled or not.&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal"   style="line-height: 150%; margin-bottom: 0.0001pt;   margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; font-family:'Times New Roman';font-size:12pt;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Finally, you must also considering making the control visible or invisible at runtime, or when should it become visible or invisible.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 24px;font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 24px;font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  line-height: 24px;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="  line-height: 20px; font-family:'times new roman';font-size:16px;"&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;"&gt;3.2 Handling some of the common controls&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3.2.1 The Text Box   &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The text box is the standard control for accepting input from the user as well as to display the output. It can handle string (text) and numeric data but not images or pictures. String in a text box can be converted to a numeric data by using the function Val(text). The following example illustrates a simple program that processes the input from the user. &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Example 3.1&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;In this program, two text boxes are inserted into the form together with a few labels. The two text boxes are used to accept inputs from the user and one of the labels will be used to display the sum of two numbers that are entered into the two text boxes. Besides, a command button is also programmed to calculate the sum of the two numbers using the plus operator. The program use creates a variable sum to accept the summation of values from text box 1 and text box 2.The procedure to calculate and to display the output on the label is shown below. The output is shown in Figure 3.2&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Command1_Click()&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;color:green;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;‘To add the values in text box 1 and text box 2&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Sum = Val(Text1.Text) + Val(Text2.Text)&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style=" ;color:green;"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;‘To display the answer on label 1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Label1.Caption = Sum&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#0000FF;"&gt;End Sub &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 255);  font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 255);  font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(51, 51, 51);   line-height: 20px; font-family:'times new roman';font-size:16px;"&gt;&lt;b&gt;&lt;center&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 3.2&lt;/span&gt;&lt;/center&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;img border="0" src="http://www.vbtutor.net/VB_Book/Images/figure3.2.jpg" width="371" height="211" align="center" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left;"&gt;&lt;span class="Apple-style-span"   style=" ;font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="  ;font-family:'times new roman';font-size:16px;"&gt;&lt;blockquote&gt;&lt;blockquote&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3.2.2 The Label    &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The label is a very useful control for Visual Basic, as it is not only used to provide instructions and guides to the users, it can also be used to display outputs. One of its most important properties is&lt;b&gt;Caption&lt;/b&gt;. Using the syntax &lt;b&gt;label.Caption&lt;/b&gt;, it can display text and numeric data . You can change its caption in the properties window and also at runtime.  Please refer to Example 3.1 and Figure 3.1 for the usage of label.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt; &lt;b&gt;3.2.3 The Command Button &lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The command button is one of the most important controls as it is used to execute commands. It displays an illusion that the button is pressed when the user click on it. The most common event associated with the command button is the Click event, and the syntax for the procedure is&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Command1_Click ()&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Statements&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3.2.4 The Picture Box &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The Picture Box is one of the controls that is used to handle graphics. You can load a picture at design phase by clicking on the picture item in the properties window and select the picture from the selected folder. You can also load the picture at runtime using the &lt;b&gt;LoadPicture &lt;/b&gt;method. For example, the statement will load the picture grape.gif into the picture box.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Picture1.Picture=LoadPicture ("C:\VB program\Images\grape.gif")&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You will learn more about the picture box in future lessons. The image in the picture box is not resizable.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt; &lt;b&gt;3.2.5 The Image Box&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The Image Box is another control that handles images and pictures. It functions almost identically to the picture box. However, there is one major difference, the image in an Image Box is stretchable, which means it can be resized. This feature is not available in the Picture Box. Similar to the Picture Box, it can also use the LoadPicture method to load the picture. For example, the statement loads the picture grape.gif into the image box.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Image1.Picture=LoadPicture ("C:\VB program\Images\grape.gif")&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt; &lt;b&gt;3.2.6 The List Box&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The function of the List Box is to present a list of items where the user can click and select the items from the list. In order to add items to the list, we can use the &lt;b&gt;AddItem method&lt;/b&gt;. For example, if you wish to add a number of items to list box 1, you can key in the following statements&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Example 3.2&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Form_Load ( )&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;List1.AddItem “Lesson1”&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;List1.AddItem “Lesson2”&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;List1.AddItem “Lesson3”&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;List1.AddItem “Lesson4”&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The items in the list box can be identified by the &lt;b&gt;ListIndex&lt;/b&gt; property, the value of the ListIndex for the first item is 0, the second item has a ListIndex 1, and the second item has a ListIndex 2 and so on&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3.2.7 The Combo Box &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The function of the Combo Box is also to present a list of items where the user can click and select the items from the list. However, the user needs to click on the small arrowhead on the right of the combo box to see the items which are presented in a drop-down list. In order to add items to the list, you can also use the &lt;b&gt;AddItem method&lt;/b&gt;. For example, if you wish to add a number of items to Combo box 1, you can key in the following statements&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Example 3.3&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Form_Load ( )&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Combo1.AddItem “Item1”&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Combo1.AddItem “Item2”&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Combo1.AddItem “Item3”&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Combo1.AddItem “Item4”&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 72pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 36pt; line-height: 100%; margin-top: -1px; margin-bottom: 0px; "&gt;&lt;span style="font-family:Verdana;font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3.2.8 The Check Box&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The Check Box control lets the user  selects or unselects an option. When the Check Box is checked, its value is set to 1 and when it is unchecked, the value is set to 0.  You can include the statements Check1.Value=1 to mark the Check Box and Check1.Value=0 to unmark the Check Box, as well as  use them to initiate certain actions. For example, the program will change the background color of the form to red when the check box is unchecked and it will change to blue when the check box is checked.  You will learn about the conditional statement If….Then….Elesif in later lesson. VbRed and vbBlue are color constants and BackColor is the background color property of the form.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3.2.9 The Option Box&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The Option Box control also lets the user selects one of the choices. However, two or more Option Boxes must work together because as one of the Option Boxes is selected, the other Option Boxes will be unselected. In fact, only one Option Box can be selected at one time. When an option box is selected, its value is set to “True” and when it is unselected; its value is set to “False”. In the following example, the shape control is placed in the form together with six Option Boxes. When the user clicks on different option boxes, different shapes will appear. The values of the shape control are 0, 1, and 2,3,4,5 which will make it appear as a rectangle, a square, an oval shape, a rounded rectangle and a rounded square respectively.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span style="font-size:85%;"&gt;&lt;span style=" font-weight: 700; font-family:Verdana;"&gt;Example 3.4&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Option1_Click ( )&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 72pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;Shape1.Shape = 0&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Option2_Click()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 72pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;Shape1.Shape = 1&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Option3_Click()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 72pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;Shape1.Shape = 2&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub &lt;/span&gt;Option4_Click()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 72pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;Shape1.Shape = 3&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;color:#0000FF;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub &lt;/span&gt;Option5_Click()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 72pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;Shape1.Shape = 4&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;Private Sub&lt;/span&gt; Option6_Click()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 72pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;Shape1.Shape = 5&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 255);  font-family:Verdana;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span class="Apple-style-span"   style="color: rgb(0, 0, 255);  font-family:Verdana;font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="color: rgb(51, 51, 51);   line-height: 20px; font-family:'times new roman';font-size:16px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;3.2.10 The Drive List Box&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The Drive ListBox is for displaying a list of drives available in your computer. When you place this control into the form and run the program, you will be able to select different drives from your computer as shown in Figure 3.3&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt; &lt;/span&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;center&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 3.3 The Drive List Box&lt;/span&gt;&lt;/center&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="center" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;img border="0" src="http://www.vbtutor.net/VB_Book/Images/figure3.3.jpg" width="363" height="227" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt; 3.2.11 The Directory List Box&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The Directory List Box is for displaying the list of directories or folders in a selected drive. When you place this control into the form and run the program, you will be able to select different directories from a selected drive in your computer as shown in Figure 3.4&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;center&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 3.4 The Directory List Box&lt;/span&gt;&lt;/center&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="center" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;img border="0" src="http://www.vbtutor.net/VB_Book/Images/figure3.4.jpg" width="342" height="217" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt; &lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;3.2.12 The File List Box&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;The File List Box is for displaying the list of files in a selected directory or folder. When you place this control into the form and run the program, you will be able to shown the list of files in a selected directory as shown in Figure 3.5&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 150%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You can coordinate the Drive List Box, the Directory List Box and the File List Box to search for the files you want. The procedure will be discussed in later lessons.&lt;/span&gt;&lt;span style="font-family:Verdana;"&gt; &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="line-height: 100%; margin-left: 36pt; margin-top: -2px; margin-bottom: 8px; "&gt;&lt;span lang="EN-US"  style=" ;font-family:Verdana;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color:#0000FF;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/div&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-7666739415764753490?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/7666739415764753490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7666739415764753490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7666739415764753490'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-3.html' title='Lesson 3. Working With Controls'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-8600479183341660731</id><published>2009-05-12T06:48:00.000-07:00</published><updated>2009-05-30T18:19:53.463-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Lesson 2'/><title type='text'>Lesson 2. Building Visual Basic Applications</title><content type='html'>&lt;span class="Apple-style-span"  style=" font-weight: bold; line-height: 16px; font-family:Verdana;"&gt;2.1 Creating Your First Application&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" font-weight: bold; line-height: 16px;font-family:Verdana;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" font-weight: bold; line-height: 16px;font-family:Verdana;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal; line-height: normal; "&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; "&gt;&lt;span style=" ;font-family:Verdana;"&gt;I&lt;/span&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;n this section, we will not go into the technical aspects of Visual Basic programming yet, what you need to do is just try out the examples below to see how does in VB program look like:&lt;/span&gt;&lt;/p&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Example 2.1.1 is a simple program. First of all, you have to launch Microsoft Visual Basic 6. Normally, a default form with the name Form1 will be available for you to start your new project. Now, double click on Form1, the source code window for Form1 as shown in figure 2.1 will appear. The top of the source code window consists of a list of objects and their associated events or procedures. In figure 2.1, the object displayed is Form and the associated procedure is Load.&lt;/span&gt;&lt;/p&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;span class="Apple-style-span" style="line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;"&gt;Figure 2.1 Source Code Window&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;img width="450" height="350" src="http://www.vbtutor.net/vb_book/images/figure2.1.jpg" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style=" line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;span class="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style=" line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px;font-size:13px;"&gt;&lt;span class="Apple-style-span" style="line-height: 16px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; "&gt;When you click on the object box, the drop-down list will display a list of objects you have inserted into your form as shown in figure 2.2. Here, you can see a form with the name Form1, a command button with the name Command1, a Label with the name Label1 and a Picture Box with the name Picture1. Similarly, when you click on the procedure box, a list of procedures associated with the object will be displayed as shown in figure 2.3. Some of the procedures associated with the object Form1 are Activate, Click, DblClick (which means Double-Click) , DragDrop, keyPress and more. Each object has its own set of procedures. You can always select an object and write codes for any of its procedure in order to perform certain tasks.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;span class="Apple-style-span" style="line-height: normal; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;&lt;span style=" ;font-family:Arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;You do not have to worry about the beginning and the end statements (i.e. &lt;b&gt;Private Sub Form_Load.......End Sub&lt;/b&gt;.); Just key in the lines in between the above two statements exactly as are shown here. When you press &lt;b&gt;F5&lt;/b&gt; to run the program, you will be surprise that nothing shown up .In order to display the output of the program, you have to add the &lt;b&gt;Form1.show&lt;/b&gt; statement like in Example 2.1.1  or you can just use &lt;b&gt;Form_Activate ( ) &lt;/b&gt; event procedure as shown in example 2.1.2. The command &lt;b&gt;Print&lt;/b&gt; does not mean printing using a printer but it means displaying the output on the computer screen. Now, press F5 or click on the run button to run the program and you will get the output as shown in figure 2.4.&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; "&gt; &lt;span style="font-family:Verdana;font-size:85%;"&gt;You can also perform arithmetic calculations as shown in example 2.1.2. VB uses &lt;b&gt;*&lt;/b&gt; to denote the multiplication operator and&lt;b&gt;/&lt;/b&gt; to denote the division operator. The output is shown in figure 2.3, where the results are arranged vertically.&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style=" line-height: normal; font-size:16px;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;p class="MsoNormal" align="center" style="text-align: center;line-height: 100%; "&gt;&lt;b&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Figure 2.2: List of Object&lt;/span&gt;&lt;span style=" ;font-family:Arial;"&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;s&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;font-size:85%;"&gt;&lt;span style=" ;font-family:Arial;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;span style=" ;font-family:Arial;"&gt;&lt;p align="justify" style="text-align: center;line-height: 100%; "&gt; &lt;/p&gt;&lt;p align="center" style="text-align: center;line-height: 100%; "&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt; &lt;img width="300" height="250" src="http://www.vbtutor.net/vb_book/images/figure2.2.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;span class="Apple-style-span"   style="  line-height: normal; font-family:Verdana;font-size:16px;"&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="font-size:85%;"&gt;&lt;p class="MsoNormal" align="center" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Figure 2.2: List of Procedures&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="center" style="line-height: 100%; "&gt; &lt;/p&gt;&lt;/span&gt;&lt;p align="center"&gt;&lt;span style="font-size:85%;"&gt;&lt;img width="300" height="250" src="http://www.vbtutor.net/vb_book/images/figure2.3.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-weight: bold; line-height: 16px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; "&gt;&lt;table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;span style="font-size:85%;"&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;"&gt;&lt;b&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Example 2.1.1                                                                  &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; margin-left: 36pt; "&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Private Sub Form_Load ( )&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; margin-left: 36pt; "&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Form1.show&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; margin-left: 36pt; "&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;Print “Welcome to Visual Basic tutorial”  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; margin-left: 36pt; "&gt;&lt;span style="font-family:Verdana;"&gt;&lt;span class="Apple-style-span"  style="font-size:small;"&gt;End Sub&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: center;line-height: 100%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span"  style="font-family:Verdana;"&gt; &lt;span class="Apple-style-span" style="color: rgb(0, 0, 0); "&gt;Figure 2.4 : The output of example 2.1.1&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;img src="http://www.vbtutor.net/vb_book/images/figure2.4.jpg" width="300" height="250" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;span class="Apple-style-span"  style="font-size:48px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;span class="Apple-style-span"  style="font-size:48px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center"&gt;&lt;span class="Apple-style-span"  style="font-size:48px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left;"&gt;&lt;span class="Apple-style-span"  style="font-size:13px;"&gt;&lt;span class="Apple-style-span"  style=" font-weight: normal; line-height: normal; font-family:Verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Example 2.1.2&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 150%; margin-left: 36pt; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Private Sub Form_Activate ( )&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 150%; margin-left: 72pt; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;Print 20 + 10&lt;br /&gt;Print 20 - 10&lt;br /&gt;Print 20 * 10&lt;br /&gt;Print 20 / 10&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 150%; margin-left: 36pt; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="line-height: 150%; margin-left: 36pt; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: center;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span"  style=" font-weight: bold; line-height: 13px; font-family:Arial;"&gt;Figure 2.5: The output of example 2.1.2&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: center;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span" style="line-height: 13px; "&gt;&lt;img width="300" height="250" src="http://www.vbtutor.net/vb_book/images/figure2.5.jpg" /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: center;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span" style="line-height: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: left;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span" style="line-height: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: left;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span" style="line-height: 13px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-weight: bold; "&gt;You can also use the &lt;b&gt;+&lt;/b&gt; or the &lt;b&gt;&amp;amp;&lt;/b&gt; operator to join two or more texts (string) together like in example 2.1.4 (a) and (b)&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: left;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-weight: bold; line-height: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: left;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-weight: bold; line-height: 13px;"&gt;&lt;span class="Apple-style-span" style="line-height: 16px; "&gt;&lt;table cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;blockquote&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Example 2.1.4(a)&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;br /&gt;Private Sub&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;A = Tom &lt;br /&gt;B = “likes" &lt;br /&gt;C = “to" &lt;br /&gt;D = “eat" &lt;br /&gt;E = “burger" &lt;br /&gt;Print A + B + C + D + E&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/td&gt;&lt;td&gt;&lt;blockquote&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;b&gt;Example 2.1.4(b)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Private Sub&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;A = Tom &lt;br /&gt;B = “likes" &lt;br /&gt;C = “to" &lt;br /&gt;D = “eat" &lt;br /&gt;E = “burger" &lt;br /&gt;Print A &amp;amp; B &amp;amp; C &amp;amp; D &amp;amp; E&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;End Sub&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: left;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-weight: bold; line-height: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" align="justify" style="text-align: left;line-height: 150%; margin-left: 36pt; "&gt;&lt;span class="Apple-style-span" style="color: rgb(51, 51, 51); font-weight: bold; line-height: 16px;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana;"&gt;The Output of Example 2.1.4(a) &amp;amp;(b) is as shown in Figure 2.7.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:Verdana;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style=" ;font-family:Arial;"&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;span style="font-size:85%;"&gt;&lt;img height="250" width="350" src="http://www.vbtutor.net/vb_book/images/figure2.7.jpg" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center" style="line-height: 100%; "&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left;line-height: 100%; "&gt;&lt;span class="Apple-style-span"   style="  ;font-family:Verdana;font-size:17px;"&gt;2.2 Steps in Building a Visual Basic Application&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left;line-height: 100%; "&gt;&lt;span class="Apple-style-span"   style=" ;font-family:Verdana;font-size:17px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p align="center" style="text-align: left;line-height: 100%; "&gt;&lt;span class="Apple-style-span"   style=" ;font-family:Verdana;font-size:17px;"&gt;&lt;span class="Apple-style-span"  style=" line-height: 16px; font-size:13px;"&gt;&lt;h4 align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="font-weight: 400; "&gt;Step 1 : Design the interface&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="font-weight: 400; "&gt;Step 2 : Set properties of the controls (Objects)&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h4 align="justify" style="line-height: 100%; "&gt;&lt;span style="font-family:Verdana;font-size:85%;"&gt;&lt;span style="font-weight: 400; "&gt;Step 3 : Write the event procedures&lt;/span&gt;&lt;/span&gt;&lt;/h4&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-8600479183341660731?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/8600479183341660731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/8600479183341660731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/8600479183341660731'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-2.html' title='Lesson 2. Building Visual Basic Applications'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-7706621727255831810</id><published>2009-05-12T06:38:00.000-07:00</published><updated>2009-12-19T06:08:32.451-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lesson'/><title type='text'>Lesson 1. Introduction to Visual Basic 6</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;span style="font-family: Verdana; font-weight: bold; white-space: normal;"&gt;&lt;span style="font-size: medium;"&gt;1.1 The concept of computer programming&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;span style="font-size: medium;"&gt;Before we begin Visual Basic 6 programming, let us understand some basic concepts of programming. According to Webopedia, a computer program is an organized list of instructions that, when executed, causes the computer to behave in a predetermined manner. Without programs, computers are useless. Therefore, programming means designing or creating a set of instructions to ask the computer to carry out certain jobs which normally are very much faster than human beings can do.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: medium;"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: medium;"&gt;A lot of people think that computer CPU is a very intelligent thing, which in actual fact it is a dumb and inanimate object that can do nothing without human assistant. The microchips of  a CPU can only understand two distinct electrical states, namely, the on and off states, or 0 and 1 codes in the binary system. So, the CPU only understands a combinations of 0 and 1 codes, a language which we called machine language. Machine language is extremely difficult to learn and it is not for us laymen to master it easily.  Fortunately , we have many smart programmers who wrote interpreters and compilers that can translate human language-like programs such as BASIC into machine language so that the computer can carry out the instructions entered by the users. Machine language  is known as the primitive language while Interpreters and compilers like Visual Basic are called high-level language. Some of the high level computer languages beside Visual Basic are  Fortran, Cobol, Java, C, C++, Turbo Pascal, and etc .   &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;span style="font-size: medium;"&gt;    &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: -webkit-monospace; white-space: pre-wrap;"&gt;&lt;span style="font-family: Verdana; font-weight: bold; white-space: normal;"&gt;&lt;span style="font-size: medium;"&gt;1.2 What programs can you create with Visual Basic 6?&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;span style="font-weight: normal;"&gt;&lt;span style="font-size: medium;"&gt;With VB 6, you can create any program depending on your objective. For example, you can create&amp;nbsp; educational programs to teach science , mathematics, language, history , geography and so on. You can also create financial and accounting programs to make you a more efficient accountant or financial controller. For those of you who like games, you can create those programs as well. Indeed, there is no limit to what program you can create ! There are many such programs in this tutorial, so you must spend more time on the tutorial in order to learn how to create those programs. If you wish to see some of the sample programs, you can take a look at the&amp;nbsp; link below:&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana;"&gt;&lt;span style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-size: 13px;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: medium;"&gt;&lt;a href="http://www.vbtutor.net/VB_Sample/sample.html" title="Sample Programs"&gt;VB Sample Programs&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;1.3 The Visual Basic 6 Integrated Development Environment&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;span style="font-size: 13px; font-weight: normal;"&gt;Before you can program in VB 6, you need to install Visual Basic 6 in your computer. If you do not own&amp;nbsp;a copy of&amp;nbsp; Visual Basic 6 software yet , you can purchase it from Amazon.com by clicking the link below:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-size: 13px;"&gt;&lt;span style="font-size: 16px;"&gt;&amp;nbsp;&lt;b&gt;&lt;a href="http://www.amazon.com/gp/product/B000S6N4VI?ie=UTF8&amp;amp;tag=liewvoonkiong&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=B000S6N4VI"&gt;Microsoft Visual Basic 6.0 Professional&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=liewvoonkiong&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=B000S6N4VI" style="border-bottom-style: none !important; border-color: initial !important; border-left-style: none !important; border-right-style: none !important; border-top-style: none !important; border-width: initial !important; margin-bottom: 0px !important; margin-left: 0px !important; margin-right: 0px !important; margin-top: 0px !important;" width="1" /&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;span style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-weight: normal;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Verdana; font-weight: bold;"&gt;&lt;span style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-weight: normal;"&gt;&lt;span style="font-size: 85%;"&gt;Basically any present computer system should be able to run the program, be it a&amp;nbsp; Intel Pentium II, Intel Pentium III, Intel Pentium IV or even AMD machines, Visual Basic 6 can run without any problem. It might not be true for VB2008, older machines might not be able to run VB2008 as it takes up much more resources, therefore I still prefer&amp;nbsp; VB 6 as it is light and easy to program. It is still very useful and powerful, and I am happy to know that Microsoft Windows Vista can support VB 6. However, if you prefer to learn VB 2008, you can refer&amp;nbsp;&lt;a href="http://www.vbtutor.net/vb2008/vb2008tutor.html"&gt;VB 2008 Tutorial&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 85%;"&gt;On start up, Visual Basic 6.0&amp;nbsp; will display the following dialog box as shown in&amp;nbsp;&lt;a href="http://www.vbtutor.net/vb11.gif"&gt;figure 1.1&lt;/a&gt;. You can choose to either start a new project, open an existing project or select a list of recently opened programs. A project is a collection of files that make up your application. There are various types of applications that we could create, however, we shall concentrate on creating Standard EXE programs (EXE means executable program). Now, click on the Standard EXE icon to go into the actual Visual Basic 6 programming environment.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-7706621727255831810?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/7706621727255831810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7706621727255831810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/7706621727255831810'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/05/lesson-1.html' title='Lesson 1. Introduction to Visual Basic 6'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-5401691951455553612</id><published>2009-04-23T19:12:00.000-07:00</published><updated>2009-04-23T19:13:14.771-07:00</updated><title type='text'>Timeline of Visual Basic (VB1 to VB6)</title><content type='html'>* Project 'Thunder' was initiated&lt;br /&gt;* Visual Basic 1.0 (May [[1991]]) was released for Windows at the Comdex/Windows World trade show in Atlanta, Georgia.&lt;br /&gt;[[Image:VBDOS-icon.PNG|right|VB DOS Logo]]&lt;br /&gt;[[Image:Microsoft Visual Basic for MS-DOS (Professional Edition Version1.00).png|thumb|right|300px|Visual Basic for MS-DOS]]&lt;br /&gt;* Visual Basic 1.0 for [[DOS]] was released in September [[1992]]. The language itself was not quite compatible with Visual Basic for Windows, as it was actually the next version of Microsoft's DOS-based BASIC compilers, [[QuickBASIC]] and BASIC Professional Development System. The interface used the [[Character Oriented Windows|"COW" (Character Oriented Windows)]] interface, using [[extended ASCII]] characters to simulate the appearance of a [[Graphical user interface|GUI]].&lt;br /&gt;* Visual Basic 2.0 was released in November [[1992]]. The programming environment was easier to use, and its speed was improved. Notably, forms became instantiable objects, thus laying the foundational concepts of class modules as were later offered in VB4.&lt;br /&gt;* Visual Basic 3.0 was released in the summer of [[1993]] and came in Standard and Professional versions. VB3 included version 1.1 of the [[Microsoft Jet Database Engine]] that could read and write Jet (or Access) 1.x databases.&lt;br /&gt;* Visual Basic 4.0 (August [[1995]]) was the first version that could create [[32-bit]] as well as [[16-bit]] Windows programs. It also introduced the ability to write non-GUI classes in Visual Basic. Incompatibilities between different releases of VB4 caused installation and operation problems. While previous versions of Visual Basic had used VBX controls, Visual Basic now used OLE controls (with files names ending in .OCX) instead. These were later to be named ActiveX controls.&lt;br /&gt;* With version 5.0 (February [[1997]]), Microsoft released Visual Basic exclusively for [[32-bit]] versions of Windows. Programmers who preferred to write 16-bit programs were able to import programs written in Visual Basic 4.0 to Visual Basic 5.0, and Visual Basic 5.0 programs can easily be converted with Visual Basic 4.0.  Visual Basic 5.0 also introduced the ability to create custom user controls, as well as the ability to compile to native Windows executable code, speeding up calculation-intensive code execution.  A free, downloadable Control Creation Edition was also released for creation of [[ActiveX|ActiveX control]]s. It was also used as an introductory form of Visual Basic: a regular .exe project could be created and run in the IDE, but not compiled. &lt;br /&gt;* Visual Basic 6.0 (Mid [[1998]]) improved in a number of areas &lt;ref&gt;{{cite web| url=http://www.insteptech.com/techLibrary/vbClassic/vb6_news.htm| title = What's new in VB6? | www.insteptech.com | publisher = www.insteptech.com | author = www.insteptech.com | year = [[2005-07-22]]}}&lt;/ref&gt; including the ability to create web-based applications. VB6 has entered Microsoft's "non-supported phase" as of March [[2008]]. Although the Visual Basic 6.0 development environment is no longer supported, the runtime is supported on Windows Vista, Windows Server 2008 and Windows 7 &lt;ref&gt;[http://msdn.microsoft.com/en-us/vbrun/ms788708.aspx Support Statement for Visual Basic 6.0 on Windows Vista, Windows Server 2008 and Windows 7&lt;/ref&gt;. &lt;br /&gt;* Mainstream Support for Microsoft Visual Basic 6.0 ended on [[March 31]], [[2005]]. Extended support ended in March 2008.&lt;ref&gt;[http://msdn2.microsoft.com/en-us/vbrun/ms788707.aspx Product Family Life Cycle Guidelines for Visual Basic 6.0&lt;!-- Bot generated title --&gt;]&lt;/ref&gt; In response, the Visual Basic user community expressed its grave concern and lobbied users to sign a petition to keep the product alive.&lt;ref&gt;[http://www.classicvb.org/petition/ Petition to Microsoft&lt;!-- Bot generated title --&gt;]&lt;/ref&gt; Microsoft has so far refused to change their position on the matter. (but see &lt;ref&gt;{{cite web| url= http://www.infoq.com/news/2009/03/vb6_on_win7 |title = Visual Basic 6.0 to be Supported on Windows 7| InfoQ | accessdate = 2009-03-05| publisher = The Register| author = Al Tenhundfeld | year = [[2009-03-04]]}}&lt;/ref&gt;) Ironically, around this time (2005), it was exposed that Microsoft's new anti-spyware offering, [[Windows Defender|Microsoft AntiSpyware]] (part of the [[GIANT Company Software]] purchase), was coded in Visual Basic 6.0.&lt;ref&gt;{{cite web| url=http://www.theregister.co.uk/2005/07/22/microsoft_spyware_vb6/| title = MS Anti-Spyware built on MS Abandonware | The Register| accessdate = 2006-10-04| publisher = The Register| author = Andrew Orlowski and Carey Bishop | year = [[2005-07-22]]}}&lt;/ref&gt;Its replacement, Windows Defender, was rewritten as C++ code.&lt;ref&gt;[http://www.winsupersite.com/reviews/windefender_beta2.asp Paul Thurrott's SuperSite for Windows: Windows Defender Beta 2 Review&lt;!-- Bot generated title --&gt;]&lt;/ref&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-5401691951455553612?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/5401691951455553612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/04/timeline-of-visual-basic-vb1-to-vb6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/5401691951455553612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/5401691951455553612'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/04/timeline-of-visual-basic-vb1-to-vb6.html' title='Timeline of Visual Basic (VB1 to VB6)'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-4609640317101773358</id><published>2009-04-23T19:10:00.000-07:00</published><updated>2009-04-23T19:11:33.932-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='evolution'/><title type='text'>==Evolution of Visual Basic==</title><content type='html'>VB 1.0 was introduced in [[1991]]. The drag and drop design for creating the user interface is derived from a prototype form generator developed by [[Alan Cooper]] and his company called ''Tripod''. Microsoft contracted with Cooper and his associates to develop Tripod into a programmable form system for Windows 3.0, under the code name ''Ruby'' (no relation to the [[Ruby (programming language)|Ruby programming language]]).&lt;br /&gt;&lt;br /&gt;Tripod did not include a programming language at all. Microsoft decided to combine Ruby with the Basic language to create Visual Basic.&lt;br /&gt;&lt;br /&gt;The Ruby interface generator provided the "visual" part of Visual Basic and this was combined with the "EB" Embedded BASIC engine designed for Microsoft's abandoned "Omega" database system. Ruby also provided the ability to load [[dynamic-link library|dynamic link libraries]] containing additional controls (then called "gizmos"), which later became the [[Visual Basic Extension|VBX]] interface&lt;ref&gt;{{cite web| url=http://www.forestmoon.com/BIRTHofVB/BIRTHofVB.html| title = The Birth of Visual Basic}}&lt;/ref&gt;.&lt;br /&gt;&lt;br /&gt;===Timeline of Visual Basic (VB1 to VB6)===&lt;br /&gt;* Project 'Thunder' was initiated&lt;br /&gt;* Visual Basic 1.0 (May [[1991]]) was released for Windows at the Comdex/Windows World trade show in Atlanta, Georgia.&lt;br /&gt;[[Image:VBDOS-icon.PNG|right|VB DOS Logo]]&lt;br /&gt;[[Image:Microsoft Visual Basic for MS-DOS (Professional Edition Version1.00).png|thumb|right|300px|Visual Basic for MS-DOS]]&lt;br /&gt;* Visual Basic 1.0 for [[DOS]] was released in September [[1992]]. The language itself was not quite compatible with Visual Basic for Windows, as it was actually the next version of Microsoft's DOS-based BASIC compilers, [[QuickBASIC]] and BASIC Professional Development System. The interface used the [[Character Oriented Windows|"COW" (Character Oriented Windows)]] interface, using [[extended ASCII]] characters to simulate the appearance of a [[Graphical user interface|GUI]].&lt;br /&gt;* Visual Basic 2.0 was released in November [[1992]]. The programming environment was easier to use, and its speed was improved. Notably, forms became instantiable objects, thus laying the foundational concepts of class modules as were later offered in VB4.&lt;br /&gt;* Visual Basic 3.0 was released in the summer of [[1993]] and came in Standard and Professional versions. VB3 included version 1.1 of the [[Microsoft Jet Database Engine]] that could read and write Jet (or Access) 1.x databases.&lt;br /&gt;* Visual Basic 4.0 (August [[1995]]) was the first version that could create [[32-bit]] as well as [[16-bit]] Windows programs. It also introduced the ability to write non-GUI classes in Visual Basic. Incompatibilities between different releases of VB4 caused installation and operation problems. While previous versions of Visual Basic had used VBX controls, Visual Basic now used OLE controls (with files names ending in .OCX) instead. These were later to be named ActiveX controls.&lt;br /&gt;* With version 5.0 (February [[1997]]), Microsoft released Visual Basic exclusively for [[32-bit]] versions of Windows. Programmers who preferred to write 16-bit programs were able to import programs written in Visual Basic 4.0 to Visual Basic 5.0, and Visual Basic 5.0 programs can easily be converted with Visual Basic 4.0. Visual Basic 5.0 also introduced the ability to create custom user controls, as well as the ability to compile to native Windows executable code, speeding up calculation-intensive code execution. A free, downloadable Control Creation Edition was also released for creation of [[ActiveX|ActiveX control]]s. It was also used as an introductory form of Visual Basic: a regular .exe project could be created and run in the IDE, but not compiled. &lt;br /&gt;* Visual Basic 6.0 (Mid [[1998]]) improved in a number of areas &lt;ref&gt;{{cite web| url=http://www.insteptech.com/techLibrary/vbClassic/vb6_news.htm| title = What's new in VB6? | www.insteptech.com | publisher = www.insteptech.com | author = www.insteptech.com | year = [[2005-07-22]]}}&lt;/ref&gt; including the ability to create web-based applications. VB6 has entered Microsoft's "non-supported phase" as of March [[2008]]. Although the Visual Basic 6.0 development environment is no longer supported, the runtime is supported on Windows Vista, Windows Server 2008 and Windows 7 &lt;ref&gt;[http://msdn.microsoft.com/en-us/vbrun/ms788708.aspx Support Statement for Visual Basic 6.0 on Windows Vista, Windows Server 2008 and Windows 7&lt;/ref&gt;. &lt;br /&gt;* Mainstream Support for Microsoft Visual Basic 6.0 ended on [[March 31]], [[2005]]. Extended support ended in March 2008.&lt;ref&gt;[http://msdn2.microsoft.com/en-us/vbrun/ms788707.aspx Product Family Life Cycle Guidelines for Visual Basic 6.0&lt;!-- Bot generated title --&gt;]&lt;/ref&gt; In response, the Visual Basic user community expressed its grave concern and lobbied users to sign a petition to keep the product alive.&lt;ref&gt;[http://www.classicvb.org/petition/ Petition to Microsoft&lt;!-- Bot generated title --&gt;]&lt;/ref&gt; Microsoft has so far refused to change their position on the matter. (but see &lt;ref&gt;{{cite web| url= http://www.infoq.com/news/2009/03/vb6_on_win7 |title = Visual Basic 6.0 to be Supported on Windows 7| InfoQ | accessdate = 2009-03-05| publisher = The Register| author = Al Tenhundfeld | year = [[2009-03-04]]}}&lt;/ref&gt;) Ironically, around this time (2005), it was exposed that Microsoft's new anti-spyware offering, [[Windows Defender|Microsoft AntiSpyware]] (part of the [[GIANT Company Software]] purchase), was coded in Visual Basic 6.0.&lt;ref&gt;{{cite web| url=http://www.theregister.co.uk/2005/07/22/microsoft_spyware_vb6/| title = MS Anti-Spyware built on MS Abandonware | The Register| accessdate = 2006-10-04| publisher = The Register| author = Andrew Orlowski and Carey Bishop | year = [[2005-07-22]]}}&lt;/ref&gt;Its replacement, Windows Defender, was rewritten as C++ code.&lt;ref&gt;[http://www.winsupersite.com/reviews/windefender_beta2.asp Paul Thurrott's SuperSite for Windows: Windows Defender Beta 2 Review&lt;!-- Bot generated title --&gt;]&lt;/ref&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-4609640317101773358?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/4609640317101773358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/04/evolution-of-visual-basic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/4609640317101773358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/4609640317101773358'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/04/evolution-of-visual-basic.html' title='==Evolution of Visual Basic=='/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-4560856478721373100</id><published>2009-04-23T19:06:00.000-07:00</published><updated>2009-04-23T19:08:50.541-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='character'/><title type='text'>==Characteristics present in Visual Basic==</title><content type='html'>Visual Basic has the following traits which differ from C-derived languages:&lt;br /&gt;* Multiple assignment available in C language is not possible. A = B = C does not imply that the values of A, B and C are equalled. The boolean result of "Is B = C?" is stored in A. The result stored in A could therefore be false(0) or true(-1)&lt;br /&gt;* [[Boolean datatype|Boolean]] constant &lt;tt&gt;True&lt;/tt&gt; has numeric value −1.&lt;ref&gt;In most languages, &lt;tt&gt;True&lt;/tt&gt; is mapped to a non zero numeric value, often 1 or -1.&lt;/ref&gt;  This is because the Boolean data type is stored as a 16-bit signed integer. In this construct −1 evaluates to 16 binary 1s (the Boolean value &lt;tt&gt;True&lt;/tt&gt;), and 0 as 16 0s (the Boolean value &lt;tt&gt;False&lt;/tt&gt;). This is apparent when performing a &lt;tt&gt;Not&lt;/tt&gt; operation on a 16 bit signed integer value 0 which will return the integer value −1, in other words &lt;tt&gt;True = Not False&lt;/tt&gt;. This inherent functionality becomes especially useful when performing logical operations on the individual bits of an integer such as &lt;tt&gt;And&lt;/tt&gt;, &lt;tt&gt;Or&lt;/tt&gt;, &lt;tt&gt;Xor&lt;/tt&gt; and &lt;tt&gt;Not&lt;/tt&gt;.&lt;ref&gt;[http://vb.mvps.org/tips/Truth.asp Microsoft Basic Logical Expression Evaluation&lt;!-- Bot generated title --&gt;]&lt;/ref&gt; This definition of &lt;tt&gt;True&lt;/tt&gt; is also consistent with BASIC since the early 1970s Microsoft BASIC implementation and is also related to the characteristics of CPU instructions at the time.&lt;br /&gt;* Logical and bitwise operators are unified. This is unlike some C-derived languages (such as [[Perl]]), which have separate logical and bitwise operators. This again is a traditional feature of BASIC.&lt;br /&gt;* Variable [[array]] base.  Arrays are declared by specifying the upper and lower bounds in a way similar to Pascal and [[Fortran]].  It is also possible to use the Option Base statement to set the default lower bound.  Use of the Option Base statement can lead to confusion when reading Visual Basic code and is best avoided by always explicitly specifying the lower bound of the array.  This lower bound is not limited to 0 or 1, because it can also be set by declaration.  In this way, both the lower and upper bounds are programmable.  In more subscript-limited languages, the lower bound of the array is not variable. This uncommon trait does exist in [[Visual Basic .NET]] but not in [[VBScript]].&lt;br /&gt;: &lt;code&gt;OPTION BASE&lt;/code&gt; was introduced by ANSI, with the standard for ANSI Minimal BASIC in the late 1970s.&lt;br /&gt;* Relatively strong integration with the [[Microsoft Windows|Windows operating system]] and the [[Component Object Model]].&lt;br /&gt;* [[Rounding#Round-to-even method|Banker's rounding]] as the default behavior when converting real numbers to integers with the &lt;code&gt;Round&lt;/code&gt; function.&lt;br /&gt;* Integers are automatically promoted to reals in expressions involving the normal division operator (&lt;tt&gt;/&lt;/tt&gt;) so that division of an odd integer by an even integer produces the intuitively correct result.  There is a specific integer divide operator (&lt;tt&gt;\&lt;/tt&gt;) which does truncate.&lt;br /&gt;* By default, if a variable has not been declared or if no type declaration character is specified, the variable is of type &lt;tt&gt;[[Variant type|Variant]]&lt;/tt&gt;. However this can be changed with Deftype statements such as &lt;tt&gt;DefInt&lt;/tt&gt;, &lt;tt&gt;DefBool&lt;/tt&gt;, &lt;tt&gt;DefVar&lt;/tt&gt;, &lt;tt&gt;DefObj&lt;/tt&gt;, &lt;tt&gt;DefStr&lt;/tt&gt;. There are 12 &lt;tt&gt;Deftype&lt;/tt&gt; statements in total offered by Visual Basic 6.0. The default type may be overridden for a specific declaration by using a special suffix character on the variable name (&lt;tt&gt;#&lt;/tt&gt; for Double, &lt;tt&gt;!&lt;/tt&gt; for Single, &lt;tt&gt;&amp;amp;&lt;/tt&gt; for Long, &lt;tt&gt;%&lt;/tt&gt; for Integer, &lt;tt&gt;$&lt;/tt&gt; for String, and &lt;tt&gt;@&lt;/tt&gt; for Currency) or using the key phrase &lt;tt&gt;As (type)&lt;/tt&gt;. VB can also be set in a mode that only explicitly declared variables can be used with the command &lt;tt&gt;Option Explicit&lt;/tt&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-4560856478721373100?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/4560856478721373100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/04/characteristics-present-in-visual-basic_23.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/4560856478721373100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/4560856478721373100'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/04/characteristics-present-in-visual-basic_23.html' title='==Characteristics present in Visual Basic=='/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7815194795950484733.post-1170131852746041912</id><published>2009-04-23T18:48:00.000-07:00</published><updated>2009-04-23T19:06:17.955-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='language'/><title type='text'>Language features</title><content type='html'>&lt;p&gt;Like the BASIC programming language, Visual Basic was designed to be easy to learn and use. The language not only allows programmers to create simple GUI applications, but can also develop complex applications. Programming in VB is a combination of visually arranging components or controls on a form, specifying attributes and actions of those components, and writing additional lines of code for more functionality. Since default attributes and actions are defined for the components, a simple program can be created without the programmer having to write many lines of code. Performance problems were experienced by earlier versions, but with faster computers and native code compilation this has become less of an issue.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;Although programs can be compiled into native code executables from version 5 onwards, they still require the presence of runtime libraries of approximately 1 MB in size. This runtime is included by default in Windows 2000 and later, but for earlier versions of Windows like 95/98/NT it must be distributed together with the executable.&lt;br /&gt;&lt;br /&gt;Forms are created using drag-and-drop techniques. A tool is used to place controls (e.g., text boxes, buttons, etc.) on the form (window). Controls have attributes and event handlers associated with them. Default values are provided when the control is created, but may be changed by the programmer. Many attribute values can be modified during run time based on user actions or changes in the environment, providing a dynamic application. For example, code can be inserted into the form resize event handler to reposition a control so that it remains centered on the form, expands to fill up the form, etc. By inserting code into the event handler for a keypress in a text box, the program can automatically translate the case of the text being entered, or even prevent certain characters from being inserted.&lt;br /&gt;&lt;br /&gt;Visual Basic can create executables (EXE files), ActiveX controls, or DLL files, but is primarily used to develop Windows applications and to interface database systems. Dialog boxes with less functionality can be used to provide pop-up capabilities. Controls provide the basic functionality of the application, while programmers can insert additional logic within the appropriate event handlers. For example, a drop-down combination box will automatically display its list and allow the user to select any element. An event handler is called when an item is selected, which can then execute additional code created by the programmer to perform some action based on which element was selected, such as populating a related list.&lt;br /&gt;&lt;br /&gt;Alternatively, a Visual Basic component can have no user interface, and instead provide ActiveX objects to other programs via Component Object Model (COM). This allows for server-side processing or an add-in module.&lt;br /&gt;&lt;br /&gt;The language is garbage collected using reference counting, has a large library of utility objects, and has basic object oriented support. Since the more common components are included in the default project template, the programmer seldom needs to specify additional libraries. Unlike many other programming languages, Visual Basic is generally not case sensitive, although it will transform keywords into a standard case configuration and force the case of variable names to conform to the case of the entry within the symbol table entry. String comparisons are case sensitive by default, but can be made case insensitive if so desired.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:lucida grande;"&gt;The Visual Basic compiler is shared with other Visual Studio languages (C, C++), but restrictions in the IDE do not allow the creation of some targets (Windows model DLL's) and threading models.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7815194795950484733-1170131852746041912?l=visualbasic6tutorial-tomy.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://visualbasic6tutorial-tomy.blogspot.com/feeds/1170131852746041912/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/04/characteristics-present-in-visual-basic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/1170131852746041912'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7815194795950484733/posts/default/1170131852746041912'/><link rel='alternate' type='text/html' href='http://visualbasic6tutorial-tomy.blogspot.com/2009/04/characteristics-present-in-visual-basic.html' title='Language features'/><author><name>tommykevinelvino</name><uri>http://www.blogger.com/profile/01996323245178266037</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='23' src='http://3.bp.blogspot.com/_IQNllxJ00oI/SnmZnvlFWzI/AAAAAAAAAKI/GYVywH0Dw88/S220/Fotoku017.jpg'/></author><thr:total>0</thr:total></entry></feed>
