<?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:blogger='http://schemas.google.com/blogger/2008' 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-6247775353130374973</id><updated>2024-10-24T11:00:47.419-07:00</updated><category term="Label1"/><title type='text'>VB6 Sample Projetcs..</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-9205941915084487050</id><published>2010-10-07T02:59:00.000-07:00</published><updated>2010-10-07T03:13:14.453-07:00</updated><title type='text'>Write a VB program that simulates the basic functions and behavior of the Windows calculator program</title><content type='html'>&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: center;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;PROGRAMMING EXERCISE&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: center;&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Calculator&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;Write a VB program that simulates the basic functions and behavior of the Windows calculator program. To study its interface, you can run it by clicking the Start button on the taskbar, then go to Programs, then Accessories. You should at least support the basic functions of addition, subtraction, and multiplication, as well as changing the sign of the number (the +/- key). It&#39;s up to you if you want to support the sqrt, %, and 1/x functions. Don&#39;t bother with the &quot;M&quot; keys on the left (MC, MR, MS, M+) or the scientific features.&lt;/span&gt;&lt;br /&gt;
&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdqkZez7lHY_dhiQ6UIoPkyzbZRdiGKla00skvCPAxaaPaFdOB_3-skbqh-hi9TNXKWKK0a5FA18K5I3X1leSfMgK13EnDAewCuwtl6x60ZY5-j82XmlShOAB_99lyNpzTOjCc1pRyhyphenhyphenSG/s1600/calc.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;246&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdqkZez7lHY_dhiQ6UIoPkyzbZRdiGKla00skvCPAxaaPaFdOB_3-skbqh-hi9TNXKWKK0a5FA18K5I3X1leSfMgK13EnDAewCuwtl6x60ZY5-j82XmlShOAB_99lyNpzTOjCc1pRyhyphenhyphenSG/s320/calc.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://www.ziddu.com/download/11980737/Calculator.rar.html&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Yam8PWbvXx6DFbGIUSLbUZ__Wlhy-L6yIMT7taF7o6QmUU12X8y9zEEnUBwS5MTbXKj69y3W6lQhaEdAvWeCBCsvxXoJCdZpI-YSmJCVgBI1ENYBkEQaJUKEI7H28M8zSPFMk4GKLAus/s1600/dl.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, sans-serif;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-family: &#39;Times New Roman&#39;; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;color: #494949; font-family: &#39;Times New Roman&#39;; font-size: 12pt; line-height: 20px; margin-bottom: 0.0001pt; margin-left: 0in; margin-right: 0in; margin-top: 0in; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/9205941915084487050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/10/write-vb-program-that-simulates-basic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/9205941915084487050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/9205941915084487050'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/10/write-vb-program-that-simulates-basic.html' title='Write a VB program that simulates the basic functions and behavior of the Windows calculator program'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdqkZez7lHY_dhiQ6UIoPkyzbZRdiGKla00skvCPAxaaPaFdOB_3-skbqh-hi9TNXKWKK0a5FA18K5I3X1leSfMgK13EnDAewCuwtl6x60ZY5-j82XmlShOAB_99lyNpzTOjCc1pRyhyphenhyphenSG/s72-c/calc.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-7857503629282268964</id><published>2010-10-05T03:45:00.001-07:00</published><updated>2015-01-13T11:19:19.054-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Label1"/><title type='text'>Combo Box in Visual Basic 6</title><content type='html'>&lt;div class=&quot;wlWriterHeaderFooter&quot; style=&quot;float:none; margin:0px; padding:4px 0px 4px 0px;&quot;&gt;&lt;iframe src=&quot;http://www.facebook.com/widgets/like.php?href=http://vb6sampleproject.blogspot.com/2010/10/combo-box-in-visual-basic-6.html&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;border:none; width:450px; height:80px&quot;&gt;&lt;/iframe&gt;&lt;/div&gt;Problem : &lt;br&gt;&lt;br&gt;&lt;span style=&quot;widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium arial, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: black; word-spacing: 0px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;line-height: 21px; font-family: verdana, sans-serif; color: #222222; font-size: 14px&quot; class=&quot;Apple-style-span&quot;&gt;I am writing a little program (calculator) in which I have a combo box with materials and their values. Such as: Glass 1.80 or LH67 1.79. My problem is that I don&#39;t know how to pick something in the drop down box and only have the numeric values enter into the equation. I get an error every time because the words (glass or LH67) are being picked as well.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;input value=&quot;1&quot; type=&quot;hidden&quot; name=&quot;IL_RELATED_TAGS&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Solvation : &lt;br&gt;&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium arial, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: black; word-spacing: 0px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;line-height: 21px; font-family: verdana, sans-serif; color: #222222; font-size: 14px&quot; class=&quot;Apple-style-span&quot;&gt;Depending on when you want to collect the data, you could use something like below.&lt;br style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px&quot;&gt;&lt;br style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px&quot;&gt;This is based on clicking a button once you have made your selection, but should be easy enough for you to add to the combobox event if necessary.&lt;br style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px&quot;&gt;&lt;/span&gt;&lt;/span&gt; &lt;div class=&quot;csharpcode&quot;&gt;&amp;nbsp;&lt;/div&gt; &lt;p&gt; &lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt; &lt;/p&gt; &lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt; &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;Private&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;Sub&lt;/span&gt; Command1_Click() &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt;    &lt;span style=&quot;color: #0000ff&quot;&gt;Dim&lt;/span&gt; astrdata() &lt;span style=&quot;color: #0000ff&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;String&lt;/span&gt;     &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt;    astrdata = Split(Combo1.Text, &lt;span style=&quot;color: #006080&quot;&gt;&quot; &quot;&lt;/span&gt;)     &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt;    MsgBox &lt;span style=&quot;color: #006080&quot;&gt;&quot;Value of &quot;&lt;/span&gt; &amp;amp; astrdata(0) &amp;amp; &lt;span style=&quot;color: #006080&quot;&gt;&quot; is : &quot;&lt;/span&gt; &amp;amp; astrdata(1) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;&lt;span style=&quot;widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium arial, sans-serif; white-space: normal; orphans: 2; letter-spacing: normal; color: black; word-spacing: 0px&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;line-height: 21px; font-family: verdana, sans-serif; color: #222222; font-size: 14px&quot; class=&quot;Apple-style-span&quot;&gt;Just to note that the data is extracted as a string.&lt;br style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px&quot;&gt;&lt;br style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px&quot;&gt;If you want to do calculations with it, you will need to validate and cast it as the relevant numeric type.&lt;br style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px&quot;&gt;&lt;br style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px&quot;&gt;Hope that helps.&lt;span class=&quot;Apple-converted-space&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt; &lt;!-- End BidVertiser code --&gt;&lt;/div&gt;  &lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/7857503629282268964/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/10/combo-box-in-visual-basic-6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/7857503629282268964'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/7857503629282268964'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/10/combo-box-in-visual-basic-6.html' title='Combo Box in Visual Basic 6'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-2183279983079080337</id><published>2010-08-25T13:19:00.000-07:00</published><updated>2015-01-13T11:19:19.051-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Label1"/><title type='text'></title><content type='html'>&lt;h2 style=&quot;text-align: justify;&quot;&gt;Using Variables In VB6&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;A &lt;i&gt;variable&lt;/i&gt; is simply a name you give to an area of memory in which a data value used by your program is stored.  When you need to retrieve that data, or modify its value, you can refer to the memory location by the variable&#39;s name.&lt;/span&gt;  &lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;The VB variable types, as well as the range or types of values they can store, are listed below:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;input name=&quot;IL_RELATED_TAGS&quot; type=&quot;hidden&quot; value=&quot;1&quot; /&gt;&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-bottom-style: none; border-bottom-width: medium; border-collapse: collapse; border-color: initial; border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; margin-left: 0px; margin-right: 0px; text-align: left; width: 691px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;border: 1pt solid windowtext; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;h4&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Variable Type&lt;/span&gt;&lt;/h4&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;h4&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Description&lt;/span&gt;&lt;/h4&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Boolean&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;2-bytes, can contain the   special values &lt;i&gt;True&lt;/i&gt; or&lt;i&gt; False&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Byte&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoHeader&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;1-byte, unsigned integer 0   to 255&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Currency&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoHeader&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;8-byte fixed-point. Stores   4 digits after the decimal point. Stores approx. +/- 922 trillion.&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Date&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoHeader&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;8-byte date/time value   from 1/1/100 to &lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;12/31/9999&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoHeader&quot;&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Additional Info: Dates   are stored internally as eight-byte Double Precision floating point variables   which can represent dates from &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;January 1, 100 A.D.&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; up to  &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;December 31, 9999&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;. The integer portion holds the date with zero   being &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;December 30, 1899&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;. Dates prior to this are stored as negative   values; those after as positive. The &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;February 12, 1997&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;, for example, is stored as 35,473. The fraction   portion holds time information. &lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Midday&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;, for example, is represented as 0.5.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Double&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;8-byte floating point   number (-1.79E+308 to 1.79E+308)&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Integer&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;2-byte integer, stores   approx. +/-32K&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Long&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;4-byte integer, stores   approx. +/-2 billion&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Object&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;A 32-bit (4-byte) address   that refers to the location of an object.&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Single&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;4-byte floating point   number (-3.40E38 to 3.40E+38)&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;String&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Variable-length: 10 bytes   + string length, holds up to 2 billion chars&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Fixed-length: holds up to   64K chars&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 95.4pt;&quot; valign=&quot;top&quot; width=&quot;127&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Variant&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 423pt;&quot; valign=&quot;top&quot; width=&quot;564&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Can hold any native data   type, object reference, and the special values &lt;i&gt;Error&lt;/i&gt;, &lt;i&gt;Empty&lt;/i&gt; and   &lt;i&gt;Null&lt;/i&gt;.  Numeric variants require 16 extra bytes, string variants   require an extra 22.&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;The rules for forming a valid VB variable name are as follows:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify; text-indent: -0.5in;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;(1)        The first character must be a letter A through Z (uppercase or lowercase letters may be used).   Succeeding characters can be letters, digits, or the underscore (_) character (no spaces or other characters allowed).&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify; text-indent: -0.5in;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify; text-indent: -0.5in;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;(2)        The final character can be a &quot;type-declaration character&quot;.  Only some of the variable types can use them, as shown below:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify; text-indent: -0.5in;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoTableGrid&quot; style=&quot;border-collapse: collapse; border: medium none; margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;border: 1pt solid windowtext; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Data Type&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;    &lt;td style=&quot;border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt; width: 279pt;&quot; valign=&quot;top&quot; width=&quot;372&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Type Declaration   Character&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;String&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;    &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 279pt;&quot; valign=&quot;top&quot; width=&quot;372&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;$&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Integer&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;    &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 279pt;&quot; valign=&quot;top&quot; width=&quot;372&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;%&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Long&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;    &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 279pt;&quot; valign=&quot;top&quot; width=&quot;372&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;&amp;amp;&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Single&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;    &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 279pt;&quot; valign=&quot;top&quot; width=&quot;372&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;!&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Double&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;    &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 279pt;&quot; valign=&quot;top&quot; width=&quot;372&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;#&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 2.75in;&quot; valign=&quot;top&quot; width=&quot;264&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Currency&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;    &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 279pt;&quot; valign=&quot;top&quot; width=&quot;372&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;@&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify; text-indent: -0.5in;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Use of type-declaration characters in VB is not encouraged; the modern style is to use the &quot;As&quot; clause in a data declaration statement (described below).&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify; text-indent: -33.75pt;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;(3)&lt;span style=&quot;font: normal normal normal 7pt/normal &#39;Times New Roman&#39;;&quot;&gt;               &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;The name can contain a maximum of 255 characters.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 2.25pt; text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: 0.5in; text-align: justify; text-indent: -0.5in;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; (4)       The name cannot be a reserved word (VB keyword).&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;VB is not case-sensitive: &lt;b&gt;PAY&lt;/b&gt;,  &lt;b&gt;Pay&lt;/b&gt; and &lt;b&gt;pay&lt;/b&gt; all refer to the same variable.  If you type a variable on a line in a case other than the case you used when you declared the variable, VB will change the case to match that of the declared variable when you leave that line.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Variable Naming Conventions&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;As long as you stick to the rules above, VB is &quot;happy&quot;; however, many programmers follow stylistic naming conventions in an effort to improve the readability of their code.  The naming conventions involve using a one-to-four character lower-case prefix to start off the name.  The purpose of the prefix is to identify the data type of the variable (like &quot;int&quot; for integers and &quot;str&quot; for strings).  These naming conventions are sometimes called &quot;Hungarian naming conventions&quot; (after Charles Simonyi, an early Microsoft programmer – and Hungarian native – who proposed the conventions).  Two other prominent programmers, Leszynski and Reddick, also have led the charge for naming conventions.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;The chart below shows each variable type, a recommended three-character prefix, and a sample variable name:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoHeader&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;MsoNormalTable&quot; style=&quot;border-bottom-style: none; border-bottom-width: medium; border-collapse: collapse; border-color: initial; border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; margin-left: 0px; margin-right: 0px; text-align: left; width: 708px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;   &lt;td style=&quot;border: 1pt solid windowtext; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;h4 align=&quot;center&quot; style=&quot;text-align: center;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Variable   Type&lt;/span&gt;&lt;/h4&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Recommended Prefix&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: windowtext windowtext windowtext -moz-use-text-color; border-style: solid solid solid none; border-width: 1pt 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div align=&quot;center&quot; class=&quot;MsoNormal&quot; style=&quot;text-align: center;&quot;&gt;&lt;b&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Sample Variable Name&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Boolean&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;bln &lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;blnDataIsValid&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Byte&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;byt&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoHeader&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;bytSmallNum&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Currency&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;cur&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;curBigMoney&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Date&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;dtm (for   &quot;Date/Time&quot;)&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;dtmEmpBirthDate&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Double&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;dbl&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;dblAnnSalary&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Integer&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;int&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;intCounter&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Long&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;lng&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;lngBigIntValue&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Object&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;obj&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;objExcelApp&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Single&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;sng&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;sngHrlyRate&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;String&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;str&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;strMyWord&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;  &lt;/tr&gt;
&lt;tr&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext; border-style: none solid solid; border-width: medium 1pt 1pt; padding: 0in 5.4pt; width: 117pt;&quot; valign=&quot;top&quot; width=&quot;156&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Variant&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 171pt;&quot; valign=&quot;top&quot; width=&quot;228&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;vnt  (or &quot;var&quot;)&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;td style=&quot;border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-style: none solid solid none; border-width: medium 1pt 1pt medium; padding: 0in 5.4pt; width: 243pt;&quot; valign=&quot;top&quot; width=&quot;324&quot;&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;vntWhatever&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;Note the style of using a lower-case, three-character prefix, followed by a descriptive name in mixed case.  This is the style of naming variables found in most VB documentation.  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;It is also recommended that you indicate the &lt;i&gt;scope&lt;/i&gt; of the variable with an additional one-character prefix in front of the variable name. My recommendations are:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;margin-top: 0in; text-align: justify;&quot; type=&quot;disc&quot;&gt;&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;None for a local variable      (i.e., a variable that is declared in a Sub or Function). Thus, variable      names like the ones in the sample names above would be used for local      variables.&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;The letter &lt;b&gt;m&lt;/b&gt; for      module-level variables (variables that are declared with Private scope in      the General Declarations section of a code module). Such variables can be      &quot;seen&quot; in any Sub or Function of that module. For example, a      String variable declared at the module level might be named &lt;b&gt;mstrEmpName&lt;/b&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;The letter &lt;b&gt;g&lt;/b&gt; for global       (project-level) variables (variables that are declared with Public scope      in the General Declarations section of a code module). Such variables can      be &quot;seen&quot; in any Sub or Function of any module in the project.      For example, a Boolean variable declared at the project level might be      named &lt;b&gt;gblnFirstTime&lt;/b&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;The letter &lt;b&gt;p&lt;/b&gt; for a      variable that is passed as an argument to a Sub or Function procedure.      Such a variable would have local scope within that procedure, but it is      defined within the procedure&#39;s header. For example, an Integer variable      passed to a Sub might be named &lt;b&gt;pintCurrCode&lt;/b&gt; when defined in the      Sub&#39;s header.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;In addition, it is recommended that the letter &lt;b&gt;a&lt;/b&gt; be used to indicate an array name. In an array name, the letter &quot;a&quot; would appear before the variable type indicator, but after the scope indicator. For example, an array of Boolean switches might be named as follows, depending on where it is declared:&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;            &lt;b&gt;ablnSwitches&lt;/b&gt;               local level&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;            &lt;b&gt;mablnSwitches            &lt;/b&gt;module level&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;            &lt;b&gt;gablnSwitches             &lt;/b&gt;global (project) level&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-family: Arial;&quot;&gt;            &lt;b&gt;pablnSwitches             &lt;/b&gt;passed parameter&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/2183279983079080337/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/using-variables-in-vb6-variable-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/2183279983079080337'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/2183279983079080337'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/using-variables-in-vb6-variable-is.html' title=''/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-1167538125131372045</id><published>2010-08-25T13:12:00.000-07:00</published><updated>2010-09-10T06:12:52.560-07:00</updated><title type='text'>Functions and Subroutines in VB6</title><content type='html'>&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-size: 130%;&quot;&gt;Functions and Subroutines in VB6&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;This lesson will instruct you on the creation and usage of functions and subroutines using Visual Basic 6.0. This lesson assumes that you can navigate the Visual Basic IDE, and create a simple project with which to test code. It is recommended that you read the Introduction to VB6 as well as the Variables and Types in VB6 lesson before starting.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;What_Are_Subroutines.3F&quot;&gt;What Are Subroutines?&lt;/span&gt;  &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Subroutines can be thought of as &lt;b&gt;miniature programs&lt;/b&gt;. A  subroutine has a name attributed with it, much like a variable does.  Unlike a variable, a subroutine doesn&#39;t hold data. Instead, it holds  code. When the code in a subroutine is executed, the subroutine is said  to be &quot;called&quot;. Therefore, one subroutine can &quot;call&quot; another subroutine.  Some subroutines are called automatically when certain actions are  performed. For example, the Form_Load subroutine is automatically called  when a form loads. This is where you have been inserting your test code  before. What you were actually doing was adding code to this  subroutine.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Why_Use_Subroutines.3F&quot;&gt;Why Use Subroutines?&lt;/span&gt; &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You may ask yourself why subroutines would even be used. Why wouldn&#39;t  you simply put all of your code in one place? Subroutines are useful  because they eliminate redundancy. Consider a complicated program like a  word processor. When certain actions are performed, such as closing the  program, opening a file, or closing an individual file, the word  processor would probably check to see if you had modified your document.  If the user had modified the document since they opened it, the user  would be prompted to save the file before performing the action. You  could imagine that checking if the document was modified, prompting the  user, and acting on the input would require many lines of code. If the  programmer had literally typed this code into all of the places in the  program where this check was to be made, it would still work fine.  However, what would happen if the way the program handles documents  changed, and therefore this code needed to be changed? The programmer  would have to change the code in every place where this check was made.  Even worse, what if the programmer changed the code in a few places but  not in another? This would lead to bugs that are difficult to track  down. Instead, if this code was put in a subroutine, the subroutine  would simply be called from all of these places. If the code then needed  to be changed, the programmer would only have to change it in one  place; inside the subroutine. By doing this, subroutines eliminate  redundant code, making the entire program easier to manage.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Creating_A_Subroutine&quot;&gt;Creating A Subroutine&lt;/span&gt; &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Creating a subroutine involves two lines of code. Luckily though, the  Visual Basic code editor is smart, and will insert the second line for  you! A subroutine begins with the word &quot;Sub&quot;, followed by a space, then a  name identifying the subroutine. Two parentheses follow, which are used  for a parameter list. Don&#39;t worry about these yet, they will be covered  later in the lesson.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;mw-geshi&quot; dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;vb source-vb&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;pre class=&quot;de1&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; TestSub()
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;After you enter the first line and press Enter, the second line will  automatically be added for you. These lines represent the start and end  of the subroutine. Any code inserted between these lines will be  executed when the subroutine is called. A subroutine can be called in  one of two ways: using the Call keyword, or by simply stating its name.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;mw-geshi&quot; dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;vb source-vb&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;pre class=&quot;de1&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; TestSub()
MsgBox &lt;span class=&quot;st0&quot;&gt;&quot;Code in TestSub()&quot;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;

&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Form_Load()
MsgBox &lt;span class=&quot;st0&quot;&gt;&quot;Code in Form_Load()&quot;&lt;/span&gt;
TestSub
MsgBox &lt;span class=&quot;st0&quot;&gt;&quot;Back in Form_Load()&quot;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You can also use the Call keyword, as mentioned above:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;mw-geshi&quot; dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;vb source-vb&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;pre class=&quot;de1&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; TestSub()
MsgBox &lt;span class=&quot;st0&quot;&gt;&quot;Code in TestSub()&quot;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;

&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Form_Load()
MsgBox &lt;span class=&quot;st0&quot;&gt;&quot;Code in Form_Load()&quot;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;&#39;This line is functionally equal as the line in the previous example
&lt;/span&gt;    &lt;span class=&quot;kw1&quot;&gt;Call&lt;/span&gt; TestSub
MsgBox &lt;span class=&quot;st0&quot;&gt;&quot;Back in Form_Load()&quot;&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Comments&quot;&gt;Comments&lt;/span&gt; &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The previous listing introduced a new syntax element: the comment. A comment is a line that is &lt;b&gt;NOT&lt;/b&gt;  source code. Instead, it is there as guidance to the person reading the  code. When programmers write programs, they usually (or at least they  should) add comments describing large sections of code that could  potentially be confusing. Comments begin with an apostrophe (&quot; &#39; &quot;) and  end with a new line. Everything that you type after the apostrophe is  ignored by Visual Basic, which is the entire point of comments. You will  see comments in all future listings describing new concepts and syntax.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Subroutine_Scope&quot;&gt;Subroutine Scope&lt;/span&gt; &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The declaration of a subroutine has an optional keyword that can be  used before &quot;Sub&quot;. You may enter a keyword representing scope here.  &quot;Private&quot; and &quot;Public&quot; are examples of scopes. You may have noticed that  the Form_Load subroutine has the word &quot;Private&quot; before &quot;Sub&quot;. This  declares that this subroutine has a Private scope. If you don&#39;t specify  the scope of a subroutine, Visual Basic will use a default scope. You  should never rely on default scope, however. Get in the habit of always  explicitly declaring the scope of your subroutines.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;What_Is_Scope.3F&quot;&gt;What Is Scope?&lt;/span&gt;  &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;[&lt;a href=&quot;http://en.wikiversity.org/w/index.php?title=Functions_and_Subroutines_in_VB6&amp;amp;action=edit&amp;amp;section=6&quot; title=&quot;Edit section: What Is Scope?&quot;&gt;edit&lt;/a&gt;]&lt;/span&gt;&lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;In the context of subroutines, scope represents where in your program  the subroutine can be called from. Subroutines with a Private scope can  only be called from the source file from where they were defined.  Subroutines with a Public scope can be called from anywhere in your  program. For example, a subroutine with a Private scope in a form can  not be called from another form, whereas it can if it has a Public  scope.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Why_Use_Scope.3F&quot;&gt;Why Use Scope?&lt;/span&gt;  &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;/span&gt;&lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Why would you ever limit where you can call a subroutine from? Why  wouldn&#39;t you make all subroutines Public so that there are no  limitations on your program? Subroutine Scope is one of many tools that  programmers can use to find bugs. If you know that your subroutine  should never be called from a different source file, you should declare  the subroutine to be Private. This will prevent you from making a silly  mistake and calling this subroutine where it shouldn&#39;t be called. This  will prevent mistakes that could be extremely damaging and hard to  detect. Instead, your program will crash with an error rather than  executing the subroutine with unpredictable results.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Parameters&quot;&gt;Parameters&lt;/span&gt;  &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Parameters, also called Arguments, are variables that can be &quot;passed  into&quot; a subroutine. A subroutine with parameters looks like this:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;mw-geshi&quot; dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;vb source-vb&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;pre class=&quot;de1&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; DisplayAdd(x &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;, y &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;)
MsgBox x + y
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;

&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Form_Load()
DisplayAdd 5, 2
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A new subroutine has been declared called DisplayAdd. This  declaration is different than the declarations that you have seen so  far, however, as code has been added between the parenthesis. From your  knowledge of variables, this syntax should look somewhat similar to you.  &lt;tt&gt;x As Integer&lt;/tt&gt; and &lt;tt&gt;y As Integer appear&lt;/tt&gt; to be variable  declarations without the &quot;Dim&quot; keyword. These declarations are separated  by a comma. These variables are the Parameters for the DisplayAdd  subroutine. Code within the subroutine can access x and y as usual, as  if they were normal variables. However, when the subroutine is called,  the calling subroutine will also provide values for these parameters.  Therefore, the subroutine has now become dynamic. The code can act on  input without caring where the input came from. When the Form_Load  subroutine calls DisplayAdd with the parameters 5 and 2, the code within  DisplayAdd is executed. The first line adds x and y together and  displays the result. x and y have already been filled with the values 5  and 2 from the Form_Load subroutine. The calling subroutine doesn&#39;t have  to use numeric constants, however. It can use variables as well:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;mw-geshi&quot; dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;vb source-vb&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;pre class=&quot;de1&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; DisplayAdd(x &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;, y &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;)
MsgBox x + y
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;

&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Form_Load()
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; a &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; b &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
a = 5
b = 2
DisplayAdd a, b
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;This code has identical results. Note that DisplayAdd cannot access a  and b. As far as DisplayAdd is concerned, a and b are represented as x  and y. Attempting to access a or b from DisplayAdd would result in an  error.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;ByRef_and_ByVal&quot;&gt;ByRef and ByVal&lt;/span&gt; &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Parameters can be sent to a subroutine By Reference (ByRef) or By  Value (ByVal). ByRef is the default, and means that changes to the  variable in the subroutine will result in changes to the source variable  outside of the subroutine. ByVal literally copies the values of the  variables from the calling subroutine into the called subroutine. By  doing this, the variables can be changed, but their values will not  change outside of the called subroutine. ByVal can also be a lot slower  with large variable types, however, since memory has to be copied from  one location to another. If you don&#39;t have any reason to do so, there is  no need to pass variables ByVal. You can explicitly state the way that a  variable is passed to a subroutine by using these keywords before the  variable name. Using the ByRef keyword, one could write a Swap function,  which switches the values of 2 variables.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;mw-geshi&quot; dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;vb source-vb&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;pre class=&quot;de1&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Swap(&lt;span class=&quot;kw1&quot;&gt;ByRef&lt;/span&gt; x &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;, &lt;span class=&quot;kw1&quot;&gt;ByRef&lt;/span&gt; y &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;)
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; temp &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
temp = x
x = y
y = temp
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;

&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; DisplayVals(&lt;span class=&quot;kw1&quot;&gt;ByRef&lt;/span&gt; a &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;, &lt;span class=&quot;kw1&quot;&gt;ByVal&lt;/span&gt; b &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;)
&lt;span class=&quot;co1&quot;&gt;&#39;Don&#39;t worry about understanding the next line yet, it will be explained later
&lt;/span&gt;    MsgBox &lt;span class=&quot;st0&quot;&gt;&quot;a = &quot;&lt;/span&gt; &amp;amp; &lt;span class=&quot;kw1&quot;&gt;CStr&lt;/span&gt;(a) &amp;amp; vbCrLf &amp;amp; &lt;span class=&quot;st0&quot;&gt;&quot;b = &quot;&lt;/span&gt; &amp;amp; &lt;span class=&quot;kw1&quot;&gt;CStr&lt;/span&gt;(b)
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;

&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Form_Load()
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; a &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; b &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
a = 10
b = 12
&lt;span class=&quot;co1&quot;&gt;&#39;Display values, swap, and display again
&lt;/span&gt;    DisplayVals a, b
&lt;span class=&quot;co1&quot;&gt;&#39;The next line is functionally identical to &quot;Swap a, b&quot;
&lt;/span&gt;    &lt;span class=&quot;kw1&quot;&gt;Call&lt;/span&gt; Swap(a, b)
DisplayVals a, b
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Notice that Call was used instead of simply stating the subroutine  name. When using the Call method however, you must use parenthesis when  calling the subroutine. Note that this program would also have worked  without typing &quot;ByRef&quot; anywhere, since it is the default. The ByRef and  ByVal keywords are rarely used in simple programs, however, but it&#39;s a  nice trick for your toolkit.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Functions&quot;&gt;Functions&lt;/span&gt; &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Subroutines have a close cousin called Functions. Functions are  basically the exact same as subroutines, except that they return a  value. That means that the function itself has a type, and the function  will return a value to the calling subroutine based on the code that it  contains. An example of this would be a function that adds two numbers,  shown below. A function is declared the exact same way as a subroutine,  except using the &quot;Function&quot; keyword instead of &quot;Sub&quot;. To return a value,  assign a value of the proper type to the function&#39;s name, as if it were  a variable.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;mw-geshi&quot; dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot;&gt;&lt;div class=&quot;vb source-vb&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;pre class=&quot;de1&quot;&gt;&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt; Add(&lt;span class=&quot;kw1&quot;&gt;ByVal&lt;/span&gt; x &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;, &lt;span class=&quot;kw1&quot;&gt;ByVal&lt;/span&gt; y &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;) &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; Res &lt;span class=&quot;kw1&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;integer&lt;/span&gt;
Res = x + y
Add = Res
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Function&lt;/span&gt;

&lt;span class=&quot;kw1&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt; Form_Load()
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; a &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; b &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;Dim&lt;/span&gt; c &lt;span class=&quot;kw1&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Integer&lt;/span&gt;
a = 32
b = 64
c = Add(a, b)
MsgBox (&lt;span class=&quot;st0&quot;&gt;&quot;Sum is : &quot;&lt;/span&gt; &amp;amp; c)
&lt;span class=&quot;kw1&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kw1&quot;&gt;Sub&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;mw-headline&quot; id=&quot;Functions_Or_Subroutines.3F&quot;&gt;Functions Or Subroutines?&lt;/span&gt; &lt;span class=&quot;editsection&quot; style=&quot;float: none; font-size: x-small; font-weight: normal; margin-left: 0px;&quot;&gt;&lt;/span&gt;&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The best way to determine which is better for your application is by  asking yourself a simple question. Will you need to return a value? If  so, use Functions. If you don&#39;t, use subroutines.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/1167538125131372045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/functions-and-subroutines-in-vb6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/1167538125131372045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/1167538125131372045'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/functions-and-subroutines-in-vb6.html' title='Functions and Subroutines in VB6'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-437998426409456481</id><published>2010-08-25T13:05:00.001-07:00</published><updated>2010-09-10T06:13:10.652-07:00</updated><title type='text'>Visual Basic 6.0 - Properties, Methods and Events</title><content type='html'>&lt;h1 style=&quot;text-align: justify;&quot;&gt;Visual Basic 6.0 - Properties, Methods and Events&lt;/h1&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;float: right; text-align: justify;&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
  &lt;!--  lqm_channel=1; lqm_publisher=148; lqm_zone=1; lqm_format=6; //--&gt; 
&lt;/script&gt; &lt;script src=&quot;http://a.lakequincy.com/s.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt; &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;All the controls in the ToolBox except the Pointer are objects in Visual  Basic. These objects have associated properties, methods and events.  &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Real world objects are loaded with properties. For example, a flower is loaded  certain color, shape and fragrance. Similarly programming  objects are loaded with properties. A property is a named attribute of a programming  object. Properties define the characteristics of an object such as Size, Color  etc. or sometimes the way in which it behaves. For example, a TextBox accepts  properties such as Enabled, Font, MultiLine, Text, Visible, Width, etc.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: justify;&quot;&gt;&lt;li&gt;  &lt;br /&gt;
Enables property allows the TextBox to be enabled or disabled at run time depending  on the condition set to True or False.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
Font property sets a particular font in the TextBox.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
MultiLine property allows the TextBox to accept and display multiple lines  at run time.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
Text property of the TextBox control sets a particular text in the control.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
Visible property is used to hide the object at run time.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
Width property sets the TextBox to the desired width at design time.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The properties that are discussed above are design-time properties that can  be set at the design tme by selecting the Properties Window. But certain properties  cannot be set at desgn time. For example, the CurrentX and CurrentY properties  of a Form cannot be set at the design time.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A method is an action that can be performed on objects. For example, a cat  is an object. Its properties might include long white hair, blue eyes, 3 pounds  weight etc. A complete definition of cat must only encompass on its looks, but  should also include a complete itemization of its activities. Therefore, a cat&#39;s  methods might be move, jump, play, breath etc.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Siimilarly in object-orinted  programming, a method is a connected or built-in procedure, a block of code  that can be invoked to impart some action on a particular object. A method requires  an object to provide them with a context. For example, the word Move has no meaning  in Visual Basic, but the statement,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;Text1.Move 700, 400&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;performs a very precise action. The TextBox control has other associated methods  such as Refresh, SetFocus, etc.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: justify;&quot;&gt;&lt;li&gt;  &lt;br /&gt;
The Refresh method enforces a complete repaint of the control or a Form. For  example, Text1.Refresh refreshes the TextBox.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
The Setfocus method moves the focus on the control. For Example Text1.SetFocus  sets the focus to TextBox control Text1.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;Event Driven Programming&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Visual Basic programs are built around events. Events are various things that can  happen in a program. this will become clearer when studied in contrast to procedural  programming.  In procedural languages, an application is written is executed by checking for  the program logically through the program statements, one after another. For a  temporary phase, the control may be transferred to some other point in a program.  While in an event driven application, the program statements are executed only  when a particular event calls a specific part of the code that is assigned to  the event.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Let us consider a TextBox control and a few of its associated events to understand  the concept of event driven programming. The TextBox control supports various  events such as Change, Click, MouseMove and many more that will be listed in the  Properties dropdown list in the code window for the TextBox control. We will look  into a few of them as given below.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;ul style=&quot;text-align: justify;&quot;&gt;&lt;li&gt; &lt;br /&gt;
The code entered in the Change event fires when there is a change in the contents  of the TextBox&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt; &lt;br /&gt;
The Click event fires when the TextBox control is clicked.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt; &lt;br /&gt;
The MouseMove event fires when the mouse is moved over the TextBox&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As explained above, several events are associated with different controls and  forms, some of the events being common to most of them and few being specific  to each control.&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/437998426409456481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/visual-basic-60-properties-methods-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/437998426409456481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/437998426409456481'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/visual-basic-60-properties-methods-and.html' title='Visual Basic 6.0 - Properties, Methods and Events'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-278164622369855460</id><published>2010-08-25T13:00:00.000-07:00</published><updated>2010-09-10T06:13:32.463-07:00</updated><title type='text'>Working with Forms in Visual Basic 6</title><content type='html'>&lt;h1 style=&quot;text-align: justify;&quot;&gt;Working with Forms in Visual Basic 6&lt;/h1&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div id=&quot;EchoTopic&quot; style=&quot;text-align: justify;&quot;&gt;&lt;h2&gt;The Appearance of Forms&lt;/h2&gt;&lt;div align=&quot;justify&quot; style=&quot;float: right;&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
  &lt;!--  lqm_channel=1; lqm_publisher=148; lqm_zone=1; lqm_format=6; //--&gt; 
&lt;/script&gt; &lt;script src=&quot;http://a.lakequincy.com/s.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt; &lt;/div&gt;The main characteristic of a Form is the title bar on which the Form&#39;s caption  is displayed. On the left end of the title bar is the Control Menu icon. Clicking  this icon opens the Control Menu. Maximize, Minimize and Close buttons can be  found on the right side of the Form. Clicking on these buttons performs the associated  function.  &lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The following figure illustrates the appearance of a Form&lt;br /&gt;
&lt;img height=&quot;211&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/F0001.JPG&quot; width=&quot;352&quot; /&gt;&lt;br /&gt;
The control menu contains the following commands :&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;  &lt;br /&gt;
&lt;b&gt;Restore &lt;/b&gt;: Restores a maximized Form to the size it was before it was  maximized; available only if the Form has been maximized.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
&lt;b&gt;Move&lt;/b&gt; : Lets the user moves the Form around with the mouse&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
&lt;b&gt;Size &lt;/b&gt;: Lets the user resizes the control with the mouse&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
&lt;b&gt;Minimize&lt;/b&gt;: Minimizes the Form&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
&lt;b&gt;Maximize&lt;/b&gt; : Maximizes the Form&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
&lt;b&gt;Close&lt;/b&gt; : Closes the Form&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;h2&gt;Setting the Start-Up Form&lt;/h2&gt;A typical application has more than a single Form. When an application runs  the main Form is loaded. By setting the Project properties you can control which  Form is to be displayed in the Start-Up of the application. Following figure illustrates  the Project property window.&lt;br /&gt;
&lt;img height=&quot;156&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/F0003.JPG&quot; width=&quot;257&quot; /&gt;&lt;br /&gt;
By default, Visual  Basic suggests the name of the first Form created when the project started.&lt;br /&gt;
&lt;h2&gt;Loading and Unloading Forms&lt;/h2&gt;In order to load and unload the forms, Load and Unload statements are used.  The Load statement has the following syntax :&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Load FormName&lt;/div&gt;And the Unload statement has the following syntax :&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Unload FormName&lt;/div&gt;The FormName variable is the name of the Form to be loaded or unloaded. Unlike  the Show method which cares of both loading and displaying the Form, the load  statement doesn&#39;t show the Form. You have to call the Form&#39;s Show method to display  it on the desktop.&lt;br /&gt;
&lt;h2&gt;Showing and Hiding Forms&lt;/h2&gt;Show method is used to Show a Form. If the Form is loaded but invisible, the  Show method is used to bring the Form on Top every other window. If the Form is  not loaded, the Show method loads it and then displays it. &lt;br /&gt;
Syntax of the Show method of the Form&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;FormName.Show mode&lt;/div&gt;The FormName variable is the Form&#39;s name&lt;b&gt;, &lt;/b&gt;and the optional argument  mode determines whether the Form will be Modal or not. It can have one of the  following syntax : &lt;b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;text2&quot;&gt;* &lt;/span&gt;&lt;/b&gt;&lt;span class=&quot;text2&quot;&gt;0-Modeless (default)&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;* 1-Modal&lt;/div&gt;Modeless Forms are the normal Forms. Modeless Forms interact with the user  and the user allowed to switch to any other Form of the application. If you do  not specify the optional mode argument, by default the mode is set to modeless.  &lt;br /&gt;
The Modal Forms takes the total control of the application where user cannot  switch to any other Forms in the application unless the Form is closed. A modal  Form, thus, must have a Close button or some means to close the Form in order  to return to the Form where the Modal Form was loaded.&lt;br /&gt;
&lt;h2&gt;Hiding Forms&lt;/h2&gt;The Hide method is used to hide a Form. The following is the syntax of the  Hide Method.&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;FormName.Hide&lt;/div&gt;To hide a Form from within its own code, the following code can be used. &lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Me.Hide&lt;/div&gt;You must understand that the Forms that are hidden are not unloaded ; they  remains in the memory and can be displayed instantly with the Show Method. When  a Form is hidden, you can still access its properties and code. For instance,  you can change the settings of its Control Properties or call any Public functions  in the Form.&lt;br /&gt;
The following is an example illustrates the Show method and Mode statement  &lt;br /&gt;
* Open a new Project and save the Project&lt;br /&gt;
Design the application as shown below&lt;br /&gt;
&lt;table border=&quot;1&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr class=&quot;text&quot;&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;b&gt;Object&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;td width=&quot;39%&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;b&gt;Property &lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;td width=&quot;37%&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;b&gt;Setting&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;Form&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;39%&quot;&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td width=&quot;37%&quot;&gt;Form1&lt;br /&gt;
frm1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;Form&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;39%&quot;&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td width=&quot;37%&quot;&gt;Form2&lt;br /&gt;
frm2&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;Form&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;39%&quot;&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td width=&quot;37%&quot;&gt;Form3&lt;br /&gt;
frm3&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;Label&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;39%&quot;&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td width=&quot;37%&quot;&gt;Click on a button to display a Form&lt;br /&gt;
Label1&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;img height=&quot;156&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/F0003.JPG&quot; width=&quot;257&quot; /&gt;&lt;br /&gt;
The following code is typed in the Click event of the command buttons&lt;br /&gt;
&lt;img height=&quot;153&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/F0004.JPG&quot; width=&quot;311&quot; /&gt;&lt;br /&gt;
Run the application. Clicking on the buttons will display the Forms respectively.  But you can see that in the cmd2_Click( ) event additionally VbModal argument  has been added. You can see the difference after you display the forms by clicking  on the command buttons. You can notice that you cannot switch to any other Forms  in the application unless you close the Form3. &lt;br /&gt;
&lt;h2&gt;Finding out the difference between Unload and Hide method&lt;/h2&gt;To know what the difference is between Unload and Hide methods we will do an  example. Open a new project and save the project. Draw two buttons on the form  and name those as shown above.&lt;br /&gt;
&lt;img height=&quot;167&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/F0005.JPG&quot; width=&quot;225&quot; /&gt;&lt;br /&gt;
In the click event of the Hide button Following code is entered.&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Me.Hide&lt;/div&gt;In the click event of the Unload button following code is entered.&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Unload Me&lt;/div&gt;Save the project and run the application. Once you click on Hide button you  can note that the Form is invisible but the application is still running. But  when you click on Unload button you can see that the application is terminated.&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/278164622369855460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/working-with-forms-in-visual-basic-6.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/278164622369855460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/278164622369855460'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/working-with-forms-in-visual-basic-6.html' title='Working with Forms in Visual Basic 6'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-6384372950202228116</id><published>2010-08-25T12:57:00.001-07:00</published><updated>2010-09-10T06:13:59.605-07:00</updated><title type='text'>PictureBox and Image Controls in Visual Basic 6</title><content type='html'>&lt;h1 style=&quot;text-align: justify;&quot;&gt;PictureBox and Image Controls in Visual Basic 6&lt;/h1&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;float: right; text-align: justify;&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
  &lt;!--  lqm_channel=1; lqm_publisher=148; lqm_zone=1; lqm_format=6; //--&gt; 
&lt;/script&gt; &lt;script src=&quot;http://a.lakequincy.com/s.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt; &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Both PictureBox and Image controls let you display an image, so let&#39;s compare  them and see when it makes sense to choose one or the other.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;The PictureBox Control&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;PictureBox controls are among the most powerful and complex items in the Visual  Basic Toolbox window. In a sense, these controls are more similar to forms than  to other controls. For example, PictureBox controls support all the properties  related to graphic output, including AutoRedraw, ClipControls, HasDC, FontTransparent,  CurrentX, CurrentY, and all the Drawxxxx, Fillxxxx, and Scalexxxx properties.  PictureBox controls also support all graphic methods, such as Cls, PSet, Point,  Line, and Circle and conversion methods, such as ScaleX, ScaleY, TextWidth, and  TextHeight. In other words, all the techniques that I described for forms can  also be used for PictureBox controls (and therefore won&#39;t be covered again in  this section).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: justify;&quot;&gt;Loading images&lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Once you place a PictureBox on a form, you might want to load an image in it,  which you do by setting the Picture property in the Properties window. You can  load images in many different graphic formats, including bitmaps (BMP), device  independent bitmaps (DIB), metafiles (WMF), enhanced metafiles (EMF), GIF and  JPEG compressed files, and icons (ICO and CUR). You can decide whether a control  should display a border, resetting the BorderStyle to 0-None if necessary. Another  property that comes handy in this phase is AutoSize: Set it to True and let the  control automatically resize itself to fit the assigned image.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You might want to set the Align property of a PictureBox control to something  other than the 0-None value. By doing that, you attach the control to one of the  four form borders and have Visual Basic automatically move and resize the PictureBox  control when the form is resized. PictureBox controls expose a Resize event, so  you can trap it if you need to move and resize its child controls too.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You can do more interesting things at run time. To begin with, you can programmatically  load any image in the control using the LoadPicture function:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;Picture1.Picture = LoadPicture(&quot;c:\windows\setup.bmp&quot;)&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;and you can clear the current image using either one of the following statements:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;&#39; These are equivalent.&lt;br /&gt;
Picture1.Picture = LoadPicture(&quot;&quot;)&lt;br /&gt;
Set Picture1.Picture = Nothing&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The LoadPicture function has been extended in Visual Basic 6 to support icon  files containing multiple icons. The new syntax is the following:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;LoadPicture(filename, [size], [colordepth], [x], [y])&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;where values in square brackets are optional. If filename is an icon file,  you can select a particular icon using the size or colordepth arguments. Valid  sizes are 0-vbLPSmall, 1-vbLPLarge (system icons whose sizes depend on the video  driver), 2-vbLPSmallShell, 3-vbLPLargeShell (shell icons whose dimensions are  affected by the Caption Button property as set in the Appearance tab in the screen&#39;s  Properties dialog box), and 4-vbLPCustom (size is determined by x and y). Valid  color depths are 0-vbLPDefault (the icon in the file that best matches current  screen settings), 1-vbLPMonochrome, 2-vbLPVGAColor (16 colors), and 3-vbLPColor  (256 colors).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You can copy an image from one PictureBox control to another by assigning the  target control&#39;s Picture property:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;Picture2.Picture = Picture1.Picture&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h3 style=&quot;text-align: justify;&quot;&gt;The PaintPicture method&lt;/h3&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;PictureBox controls are equipped with a very powerful method that enables the  programmer to perform a wide variety of graphic effects, including zooming, scrolling,  panning, tiling, flipping, and many fading effects: This is the PaintPicture method.  (This method is also exposed by form objects, but it&#39;s most often used with PictureBox  controls.) In a nutshell, this method performs a pixel-by-pixel copy from a source  control to a destination control. The complete syntax of this method is complex  and rather confusing:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;DestPictBox.PaintPicture SrcPictBox.Picture, destX, destY, [destWidth], _&lt;br /&gt;
[destHeight], [srcX], [srcY2], [srcWidth], [srcHeight], [Opcode])&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The only required arguments are the source PictureBox control&#39;s Picture property  and the coordinates inside the destination control where the image must be copied.  The destX / destY arguments are expressed in the ScaleMode of the destination  control; by varying them, you can make the image appear exactly where you want.  For example, if the source PictureBox control contains a bitmap 3000 twips wide  and 2000 twips tall, you can center this image on the destination control with  this command:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;picDest.PaintPicture picSource.Picture, (picDest.ScaleWidth - 3000) / 2, _&lt;br /&gt;
(picDest.ScaleHeight - 2000) / 2&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;In general, Visual Basic doesn&#39;t provide a way to determine the size of a bitmap  loaded into a PictureBox control. But you can derive this information if you set  the control&#39;s AutoSize property to True and then read the control&#39;s ScaleWidth  and ScaleHeight properties. If you don&#39;t want to resize a visible control just  to learn the dimensions of a bitmap, you can load it into an invisible control,  or you can use this trick, based on the fact that the Picture property returns  an StdPicture object, which in turn exposes the Height and Width properties:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&#39; StdPicture&#39;s Width and Height properties are expressed in&lt;br /&gt;
&#39; Himetric units.&lt;br /&gt;
With Picture1&lt;br /&gt;
width = CInt(.ScaleX(.Picture.Width, vbHimetric, vbPixels))&lt;br /&gt;
height = CInt(.ScaleY(.Picture.Height, vbHimetric, _&lt;br /&gt;
vbPixels))&lt;br /&gt;
End With&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;By the way, in all subsequent code examples I assume that the source PictureBox  control&#39;s ScaleWidth and ScaleHeight properties match the actual bitmap&#39;s size.  By default, the PaintPicture method copies the entire source bitmap. But you can  copy just a portion of it, passing a value for srcWidth and srcHeight:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;&#39; Copy the upper left portion of the source image.&lt;br /&gt;
picDest.PaintPicture picSource.Picture, 0, 0, , , , , _&lt;br /&gt;
picSource.ScaleWidth / 2, picSource.ScaleHeight / 2&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;If you&#39;re copying just a portion of the source image, you probably want to  pass a specific value for the srcX and srcY values as well, which correspond to  the coordinates of the top-left corner of the area that will be copied from the  source control:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;&#39; Copy the bottom-right portion of the source image&lt;br /&gt;
&#39; in the corresponding corner in the destination.&lt;br /&gt;
wi = picSource.ScaleWidth / 2&lt;br /&gt;
he = picSource.ScaleHeight / 2&lt;br /&gt;
picDest.PaintPicture picSource.Picture, wi, he, , , wi, he, wi, he&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;You can use this method to tile a target PictureBox control (or form) with  multiple copies of an image stored in another control:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;&#39; Start with the leftmost column.&lt;br /&gt;
x = 0&lt;br /&gt;
Do While x &amp;lt; y =&quot; 0&quot; y =&quot; y&quot; x =&quot; x&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Another great feature of the PaintPicture method lets you resize the image  while you transfer it, and you can even specify different zoom-in and zoom-out  factors for the x- and y-axes independently. You just have to pass a value to  the destWidth and destHeight arguments: If these values are greater than the source  image&#39;s corresponding dimensions, you achieve a zoom-in effect, and if they are  less you get a zoom-out effect. For example, see how you can double the size of  the original image:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;picDest.PaintPicture picSource.Picture, 0, 0, _&lt;br /&gt;
picSource.ScaleWidth * 2, picSource.ScaleHeight * 2&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As a special case of the syntax of the PaintPicture method, the source image  can even be flipped along its x-axis, y-axis, or both by passing negative values  for these arguments:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;&#39; Flip horizontally.&lt;br /&gt;
picDest.PaintPicture picSource.Picture, _&lt;br /&gt;
picSource.ScaleWidth, 0, -picSource.ScaleWidth&lt;br /&gt;
&#39; Flip vertically.&lt;br /&gt;
picDest.PaintPicture picSource.Picture, 0, _&lt;br /&gt;
picSource.ScaleHeight, , -picSource.ScaleHeight&lt;br /&gt;
&#39; Flip the image on both axes.&lt;br /&gt;
picDest.PaintPicture picSource.Picture, picSource.ScaleWidth, _&lt;br /&gt;
picSource.ScaleHeight, -picSource.ScaleWidth, -picSource.ScaleHeight&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As you might expect, you can combine all these effects together, magnifying,  reducing, or flipping just a portion of the source image, and have the result  appear in any point of the destination PictureBox control (or form). You should  find no problem in reusing all those routines in your own applications.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As if all these capabilities weren&#39;t enough, we haven&#39;t covered the last argument  of the PaintPicture method yet. The opcode argument lets you specify which kind  of Boolean operation must be performed on pixel bits as they&#39;re transferred from  the source image to the destination. The values you can pass to this argument  are the same that you assign to the DrawMode property. The default value is 13-vbCopyPen,  which simply copies the source pixels in the destination control. By playing with  the other settings, you can achieve many interesting graphical effects, including  simple animations.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;h2 style=&quot;text-align: justify;&quot;&gt;The Image Control&lt;/h2&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Image controls are far less complex than PictureBox controls. They don&#39;t support  graphical methods or the AutoRedraw and the ClipControls properties, and they  can&#39;t work as containers, just to hint at their biggest limitations. Nevertheless,  you should always strive to use Image controls instead of PictureBox controls  because they load faster and consume less memory and system resources. Remember  that Image controls are windowless objects that are actually managed by Visual  Basic without creating a Windows object. Image controls can load bitmaps and JPEG  and GIF images.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;When you&#39;re working with an Image control, you typically load a bitmap into  its Picture property either at design time or at run time using the LoadPicture  function. Image controls don&#39;t expose the AutoSize property because by default  they resize to display the contained image (as it happens with PictureBox controls  set at AutoSize = True). On the other hand, Image controls support a Stretch property  that, if True, resizes the image (distorting it if necessary) to fit the control.  In a sense, the Stretch property somewhat remedies the lack of the PaintPicture  method for this control. In fact, you can zoom in to or reduce an image by loading  it in an Image control and then setting its Stretch property to True to change  its width and height:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;text2&quot; style=&quot;text-align: justify;&quot;&gt;&#39; Load a bitmap.&lt;br /&gt;
Image1.Stretch = False&lt;br /&gt;
Image1.Picture = LoadPicture(&quot;c:\windows\setup.bmp&quot;)&lt;br /&gt;
&#39; Reduce it by a factor of two.&lt;br /&gt;
Image1.Stretch = True&lt;br /&gt;
Image1.Move 0, 0, Image1.Width / 2, Image1.Width / 2&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Image controls support all the usual mouse events. For this reason, many Visual  Basic developers have used Image controls to simulate graphical buttons and toolbars.  Now that Visual Basic natively supports these controls, you&#39;d probably better  use Image controls only for what they were originally intended.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/6384372950202228116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/picturebox-and-image-controls-in-visual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/6384372950202228116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/6384372950202228116'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/picturebox-and-image-controls-in-visual.html' title='PictureBox and Image Controls in Visual Basic 6'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-8101442122695869015</id><published>2010-08-25T12:40:00.000-07:00</published><updated>2010-09-10T06:14:20.871-07:00</updated><title type='text'>Using ListBox and ComboBox Controls In Visual Basic 6</title><content type='html'>&lt;h1&gt;Using ListBox and ComboBox Controls In Visual Basic 6&lt;/h1&gt;&lt;div align=&quot;justify&quot; style=&quot;float: right;&quot;&gt;&lt;script type=&quot;text/javascript&quot;&gt;
  &lt;!--  lqm_channel=1; lqm_publisher=148; lqm_zone=1; lqm_format=6; //--&gt; 
&lt;/script&gt; &lt;script src=&quot;http://a.lakequincy.com/s.js&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt; &lt;/div&gt;ListBox and ComboBox controls present a set of choices that are displayed vertically  in a column. If the number of items exceed the value that be displayed, scroll  bars will automatically appear on the control. These scroll bars can be scrolled  up and down or left to right through the list. &lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The following Fig lists some of the common &lt;b&gt;ComboBox&lt;/b&gt; properties and methods.&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr bgcolor=&quot;#eeeeee&quot;&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;b&gt;Property/Method&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;b&gt;Description&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td colspan=&quot;2&quot;&gt;&lt;b&gt; Properties&lt;br /&gt;
&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;Enabled&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;By setting this property to True or False user can decide whether  user can interact with this control or not&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;Index&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Specifies the Control array index&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;List&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;String array. Contains the strings displayed in the drop-down  list. Starting array index is 0.&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;ListCount&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Integer. Contains the number of drop-down list items&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; height=&quot;30&quot; width=&quot;24%&quot;&gt;&lt;b&gt;ListIndex&lt;/b&gt;&lt;/td&gt; &lt;td height=&quot;30&quot; width=&quot;76%&quot;&gt;Integer. Contains the index of the selected ComboBox  item. If an item is not selected, ListIndex is -1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;Locked&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Boolean. Specifies whether user can type or not in the ComboBox&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;MousePointer&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Integer. Specifies the shape of the mouse pointer when over the  area of the ComboBox&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;NewIndex&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Integer. Index of the last item added to the ComboBox. If the  ComboBox does not contain any items , NewIndex is -1&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;Sorted&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Boolean. Specifies whether the ComboBox&#39;s items are sorted or  not.&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;Style&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Integer. Specifies the style of the ComboBox&#39;s appearance&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;TabStop&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Boolean. Specifies whether ComboBox receives the focus or not.&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;Text&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;String. Specifies the selected item in the ComboBox&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;ToolTipIndex&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;String. Specifies what text is displayed as the ComboBox&#39;s tool  tip&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td bgcolor=&quot;#ffffff&quot; width=&quot;24%&quot;&gt;&lt;b&gt;Visible&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Boolean. Specifies whether ComboBox is visible or not at run time&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td colspan=&quot;2&quot;&gt;&lt;b&gt; Methods&lt;/b&gt; &lt;br /&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;AddItem&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Add an item to the ComboBox&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;Clear&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Removes all items from the ComboBox &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;RemoveItem&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Removes the specified item from the ComboBox&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;SetFocus&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Transfers focus to the ComboBox&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td colspan=&quot;2&quot;&gt;&lt;b&gt;Event Procedures&lt;br /&gt;
&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;Change&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Called when text in ComboBox is changed&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;DropDown&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Called when the ComboBox drop-down list is displayed&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td height=&quot;20&quot; width=&quot;24%&quot;&gt;&lt;b&gt;GotFocus&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Called when ComboBox receives the focus&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td width=&quot;24%&quot;&gt;&lt;b&gt;LostFocus&lt;/b&gt;&lt;/td&gt; &lt;td width=&quot;76%&quot;&gt;Called when ComboBox loses it focus&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;h2&gt;Adding items to a List&lt;/h2&gt;It is possible to populate the list at design time or run time&lt;br /&gt;
&lt;b&gt;Design Time&lt;/b&gt; : To add items to a list at design time, click on List property  in the property box and then add the items. Press CTRL+ENTER after adding each  item as shown below.&lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;img height=&quot;114&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/005.JPG&quot; width=&quot;152&quot; /&gt;&lt;/div&gt;&lt;b&gt;Run Time : &lt;/b&gt;The AddItem method is used to add items to a list at run  time. The AddItem method uses the following syntax.&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Object.AddItemitem, Index&lt;/div&gt;The&lt;i&gt; &lt;b&gt;item&lt;/b&gt;&lt;/i&gt; argument is a string that represents the text to add  to the list&lt;br /&gt;
The&lt;i&gt; &lt;b&gt;index&lt;/b&gt; &lt;/i&gt;argument is an integer that indicates where in the  list to add the new item. Not giving the index is not a problem, because by default  the index is assigned. &lt;br /&gt;
Following is an example to add item to a combo box. The code is typed in the  Form_Load event&lt;br /&gt;
&lt;div align=&quot;left&quot; class=&quot;text2&quot;&gt;Private Sub Form_Load()&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;text2&quot;&gt;Combo1.AddItem 1&lt;br /&gt;
Combo1.AddItem 2&lt;br /&gt;
Combo1.AddItem 3&lt;br /&gt;
Combo1.AddItem 4&lt;br /&gt;
Combo1.AddItem 5&lt;br /&gt;
Combo1.AddItem 6&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;text2&quot;&gt;End Sub&lt;/div&gt;&lt;h2&gt;Removing Items from a List &lt;/h2&gt;The RemoveItem method is used to remove an item from a list. The syntax for  this is given below.&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Object.RemoveItem index&lt;/div&gt;The following code verifies that an item is selected in the list and then removes  the selected item from the list.&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Private Sub cmdRemove_Click()&lt;br /&gt;
If List1.ListIndex &amp;gt; -1 Then&lt;br /&gt;
List1.RemoveItem List1. ListIndex&lt;br /&gt;
End If&lt;br /&gt;
End Sub&lt;/div&gt;&lt;h2&gt;Sorting the List&lt;/h2&gt;The Sorted property is set to True to enable a list to appear in alphanumeric  order and False to display the list items in the order which they are added to  the list.&lt;br /&gt;
&lt;h2&gt;Using the ComboBox&lt;/h2&gt;A ComboBox combines the features of a TextBox and a ListBox. This enables the  user to select either by typing text into the ComboBox or by selecting an item  from the list. There are three types of ComboBox styles that are represented as  shown below.&lt;br /&gt;
&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;  &lt;td height=&quot;85&quot; width=&quot;33%&quot;&gt;&lt;img height=&quot;81&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/008.JPG&quot; width=&quot;86&quot; /&gt;&lt;br /&gt;
Dropdown combo&lt;/td&gt; &lt;td height=&quot;85&quot; width=&quot;29%&quot;&gt;&lt;img height=&quot;23&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/009.JPG&quot; width=&quot;86&quot; /&gt;&lt;br /&gt;
Simple combo&lt;/td&gt; &lt;td height=&quot;85&quot; width=&quot;38%&quot;&gt;&lt;img height=&quot;78&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/010.JPG&quot; width=&quot;86&quot; /&gt;&lt;br /&gt;
Dropdown list&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;ul&gt;&lt;li&gt;  &lt;br /&gt;
Dropdown Combo (style 0)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
Simple Combo (style 1)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
Dropdown List (style 2)&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;The Simple Combo box displays an edit area with an attached list box always  visible immediately below the edit area. A simple combo box displays the contents  of its list all the time. The user can select an item from the list or type an  item in the edit box portion of the combo box. A scroll bar is displayed beside  the list if there are too many items to be displayed in the list box area.&lt;br /&gt;
The Dropdown Combo box first appears as only an edit area with a down arrow  button at the right. The list portion stays hidden until the user clicks the down-arrow  button to drop down the list portion. The user can either select a value from  the list or type a value in the edit area. &lt;br /&gt;
The Dropdown list combo box turns the combo box into a Dropdown list box. At  run time , the control looks like the Dropdown combo box. The user could click  the down arrow to view the list. The difference between Dropdown combo &amp;amp; Dropdown  list combo is that the edit area in the Dropdown list combo is disabled. The user  can only select an item and cannot type anything in the edit area. Anyway this  area displays the selected item. &lt;br /&gt;
&lt;div align=&quot;left&quot;&gt;&lt;b&gt;Example &lt;/b&gt;&lt;/div&gt;This example is to Add , Remove, Clear the list of items and finally close  the application. &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;  &lt;br /&gt;
Open a new Standard EXE project is opened an named the Form as Listbox.frm  and save the project as Listbox.vbp&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;br /&gt;
Design the application as shown below.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;table border=&quot;1&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;  &lt;td&gt;&lt;div align=&quot;center&quot;&gt;&lt;b&gt;Object&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;td&gt;&lt;div align=&quot;center&quot;&gt;&lt;b&gt;Property&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;td&gt;&lt;div align=&quot;center&quot;&gt;&lt;b&gt;Settings&lt;/b&gt;&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;Form&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td&gt;ListBox&lt;br /&gt;
frmListBox&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;TextBox &lt;/b&gt;&lt;/td&gt; &lt;td&gt;Text&lt;br /&gt;
Name&lt;/td&gt; &lt;td&gt;(empty)&lt;br /&gt;
txtName&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;Label&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td&gt;Enter a name&lt;br /&gt;
lblName&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;ListBox&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Name&lt;/td&gt; &lt;td&gt;lstName&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;Label&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td&gt;Amount Entered&lt;br /&gt;
lblAmount&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;Label&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Caption&lt;br /&gt;
Name&lt;br /&gt;
Border Style&lt;/td&gt; &lt;td&gt;(empty)&lt;br /&gt;
lblDisplay&lt;br /&gt;
1 Fixed Single&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;CommandButton&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td&gt;Add&lt;br /&gt;
cmdAdd&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;CommandButton&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td&gt;Remove&lt;br /&gt;
cmdRemove&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;CommandButton&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td&gt;Clear&lt;br /&gt;
cmdClear&lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;  &lt;td&gt;&lt;b&gt;CommandButton&lt;/b&gt;&lt;/td&gt; &lt;td&gt;Caption&lt;br /&gt;
Name&lt;/td&gt; &lt;td&gt;Exit&lt;br /&gt;
cmdExit&lt;/td&gt; &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;div align=&quot;left&quot;&gt;&lt;img height=&quot;192&quot; src=&quot;http://visualbasic.freetutes.com/learn-vb6/images/011.JPG&quot; width=&quot;258&quot; /&gt;&lt;/div&gt;The following event procedures are entered for the TextBox and CommandButton  controls.&lt;br /&gt;
&lt;div class=&quot;text2&quot;&gt;Private Sub txtName_Change()&lt;br /&gt;
If (Len(txtName.Text) &amp;gt; 0) Then &#39;Enabling the Add button&lt;br /&gt;
&#39;if atleast one character&lt;br /&gt;
&#39;is entered&lt;br /&gt;
cmdAdd.Enabled = True&lt;br /&gt;
End If&lt;br /&gt;
End Sub&lt;/div&gt;&lt;div align=&quot;left&quot; class=&quot;text2&quot;&gt;Private Sub cmdAdd_Click()&lt;br /&gt;
lstName.AddItem txtName.Text &#39;Add the entered the characters to the list box&lt;br /&gt;
&lt;br /&gt;
txtName.Text = &quot;&quot; &#39;Clearing the text box&lt;br /&gt;
&lt;br /&gt;
txtName.SetFocus &#39;Get the focus back to the&lt;br /&gt;
&#39;text box&lt;br /&gt;
&lt;br /&gt;
lblDisplay.Caption = lstName.ListCount &#39;Display the number of items in the list  box&lt;br /&gt;
&lt;br /&gt;
cmdAdd.Enabled = False &#39; Disabling the Add button&lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;End Sub&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;The click event of the Add button adds the text to the list box  that was typed in the Text box. Then the text box is cleared and the focus is  got to the text box. The number of entered values will is increased according  to the number of items added to the listbox. &lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;Private Sub cmdClear_Click()&lt;br /&gt;
lstName.Clear&lt;br /&gt;
lblDisplay.Caption = lstName.ListCount&lt;br /&gt;
End Sub&lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;Private Sub cmdExit_Click()&lt;br /&gt;
Unload Me&lt;br /&gt;
End Sub&lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;Private Sub cmdRemove_Click()&lt;br /&gt;
Dim remove As Integer&lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;remove = lstName.ListIndex &#39;Getting the index&lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;If remove &amp;gt;= 0 Then &#39;make sure an item is selected&lt;br /&gt;
&#39;in the list box&lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;lstName.RemoveItem remove &#39;Remove item from the list box&lt;br /&gt;
&lt;br /&gt;
lblDisplay.Caption = lstName.ListCount &#39;Display the number of items&lt;br /&gt;
&#39;in the listbox&lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;End If&lt;/div&gt;&lt;div class=&quot;text2&quot;&gt;End Sub&lt;/div&gt;Remove button removes the selected item from the list as soon as you pressed  the Remove button. The number of items is decreased in the listbox and the value  is displayed in the label.&lt;br /&gt;
The code for the clear button clears the listbox when you press it. And the  number of items shown in the label becomes 0.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/8101442122695869015/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/using-listbox-and-combobox-controls-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/8101442122695869015'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/8101442122695869015'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/using-listbox-and-combobox-controls-in.html' title='Using ListBox and ComboBox Controls In Visual Basic 6'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-5541188671736307094</id><published>2010-08-25T12:22:00.000-07:00</published><updated>2010-09-10T06:14:59.598-07:00</updated><title type='text'>Working with Command Button</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;The CommandButton is used to make an action happen e.g. process the inputs that have been entered onto a Form and then show the output.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.martin2k.co.uk/vb6/tips/vb_42_1.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://www.martin2k.co.uk/vb6/tips/vb_42_1.png&quot; style=&quot;cursor: pointer; display: block; height: 240px; margin: 0px auto 10px; text-align: center; width: 320px;&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The naming convention for the CommandButton is &#39;cmd&#39;.  E.g. cmdExit.  Also, CommandButton&#39;s look more professional if you set the Height property to 375, unless your creating Graphical buttons of course.&lt;br /&gt;
&lt;h3&gt;Properties&lt;/h3&gt;&lt;h4&gt;BackColor&lt;/h4&gt;Sets the colour of the CommandButton&#39;s background.  This property only takes effect when the Style property is set to 1 - Graphical.&lt;br /&gt;
&lt;h4&gt;Cancel&lt;/h4&gt;If this property is set to True, pressing the Escape key at runtime will activate the CommandButton&#39;s Click event.  Only one CommandButton on the Form can have this property set to True.&lt;br /&gt;
&lt;h4&gt;Caption&lt;/h4&gt;Sets the text to be displayed on the CommandButton.&lt;br /&gt;
If possible keep this as short as possible, so you don&#39;t have to resize the CommandButton.  You can always use the ToolTipText property if you want to give the user further information.&lt;br /&gt;
You can use mnemonics e.g. putting the &#39;&amp;amp;&#39; symbol somewhere in the Caption will cause the following character to be underlined at runtime.  When the user presses the Alt+[Underlined Letter] key combination, the CommandButton&#39;s Click event will be called.&lt;br /&gt;
&lt;h4&gt;Default&lt;/h4&gt;Works in a similar way to the Cancel property, but with the Enter key.  The CommandButton, which has this property set to True, will also appear with a darker border.&lt;br /&gt;
&lt;h4&gt;DisabledPicture&lt;/h4&gt;Sets the picture to be displayed when the Enabled property is set to False.  The Style property must be set to 1 - Graphical.&lt;br /&gt;
&lt;h4&gt;DownPicture&lt;/h4&gt;Sets the picture to be displayed while the button is pressed down i.e. when the user holds the mouse button or the space key on it.  The Style property must be set to 1 - Graphical.&lt;br /&gt;
&lt;h4&gt;Enabled&lt;/h4&gt;When this property is set to True, the user is not able to interact with the CommandButton in any way e.g. it cannot be clicked on or have focus.  The caption will appear greyed out.&lt;br /&gt;
&lt;h4&gt;Font&lt;/h4&gt;In design time, this brings up the Font dialog box to allow you to choose the font name, style, size and whether the Strikeout and Underline attributes are set.  When writing code to set the font of the CommandButton, Font acts as an object, which has its own properties:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Bold&lt;/li&gt;
&lt;li&gt;Charset&lt;/li&gt;
&lt;li&gt;Italic&lt;/li&gt;
&lt;li&gt;Name&lt;/li&gt;
&lt;li&gt;Size&lt;/li&gt;
&lt;li&gt;Strikethrough&lt;/li&gt;
&lt;li&gt;Underline&lt;/li&gt;
&lt;li&gt;Weight&lt;/li&gt;
&lt;/ul&gt;For example:&lt;br /&gt;
&lt;table border=&quot;1&quot; class=&quot;vbtable&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;Command1.Font.Bold = &lt;span style=&quot;color: navy;&quot;&gt; True&lt;/span&gt;&lt;br /&gt;
Command1.Font.Italic = &lt;span style=&quot;color: navy;&quot;&gt;True&lt;/span&gt;&lt;br /&gt;
Command1.Font.Underline = &lt;span style=&quot;color: navy;&quot;&gt; True&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;Alternatively, you can use the FontBold (Boolean), FontItalic (Boolean), FontName (String), FontSize (Single), FontStrikethru (Boolean) and FontUnderline (Boolean) properties, which are only available at runtime.&lt;br /&gt;
&lt;h4&gt;Height&lt;/h4&gt;Sets the height of the CommandButton.&lt;br /&gt;
&lt;h4&gt;Index&lt;/h4&gt;Leave blank unless the CommandButton is to be part of a control array.&lt;br /&gt;
&lt;h4&gt;Left&lt;/h4&gt;Sets the X coordinate of the CommandButton.&lt;br /&gt;
&lt;h4&gt;MaskColor&lt;/h4&gt;This property only comes into effect when the following conditions are met - the Style property is set to 1 - Graphical, the UseMaskColor property is set to True and a background picture is being displayed on the CommandButton.  The colour that is set in the MaskColor property will become the transparent colour in the picture.  E.g. if white is used in the picture, setting the MaskColor to white will mean that white changes the background colour of the CommandButton (i.e. changes to being transparent).&lt;br /&gt;
You should not use a system colour for the MaskColor property because system colours are changeable by the user.  This means that the CommandButton would end up with no colour being made transparent, which would not be the desired effect.&lt;br /&gt;
&lt;h4&gt;MouseIcon&lt;/h4&gt;When the user hover&#39;s the mouse pointer over the CommandButton, the image set for this property will become the mouse icon.  This property will only work if the MousePointer property is set to 99 - Custom.&lt;br /&gt;
&lt;h4&gt;MousePointer&lt;/h4&gt;Sets the type of mouse pointer to be used when the user hovers the mouse over the CommandButton.  The possible choices are:&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; class=&quot;tback&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Value&lt;/th&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Name&lt;/th&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Constant&lt;/th&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;0&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Default&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbDefault&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;1&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Arrow&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbArrow&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;2&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Cross&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbCrosshair&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;3&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;I-Beam&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbIbeam&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;4&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Icon&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbIconPointer&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;5&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Size&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbSizePointer&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;6&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Size NE SW&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbSizeNESW&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;7&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Size N S&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbSizeNS&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;8&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Size NW SE&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbSizeNWSE&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;9&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Size W E&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbSizeWE&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;10&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Up Arrow&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbUpArrow&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;11&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Hourglass&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbHourglass&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;12&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;No Drop&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbNoDrop&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;13&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Arrow and hourglass&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbArrowHourglass&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;14&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Arrow and Question&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbArrowQuestion&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;15&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Size All&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbSizeAll&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;99&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Custom&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbCustom&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/center&gt;  &lt;br /&gt;
&lt;h4&gt;Picture&lt;/h4&gt;Sets the picture, which is displayed in the background of the CommandButton.  If the picture is smaller than the CommandButton, it will appear in the centre and the CommandButton&#39;s caption will appear underneath.  The Style property needs to be set to 1 - Graphical for this property to work.&lt;br /&gt;
&lt;h4&gt;Style&lt;/h4&gt;This needs to be set to 1 - Graphical if you want to use the graphical properties of the CommandButton (apart from Fonts).&lt;br /&gt;
&lt;h4&gt;TabIndex&lt;/h4&gt;Sets the order in which the controls will get focus when the tab key is pressed.  The control that has 0 as its TabIndex will have focus when the Form is loaded.&lt;br /&gt;
&lt;h4&gt;TabStop&lt;/h4&gt;If you set this to False, the CommandButton will not get focus when the tab key is pressed.&lt;br /&gt;
&lt;h4&gt;Tag&lt;/h4&gt;This property can be set to a string if you need to store any extra information related to the CommandButton.&lt;br /&gt;
&lt;h4&gt;ToolTipText&lt;/h4&gt;When this property is set, the text will popup over the CommandButton when the user hovers the mouse pointer over it.  This can be useful if you cannot fit all the text you need to in the Caption.&lt;br /&gt;
&lt;h4&gt;Top&lt;/h4&gt;Sets the Y coordinate of the CommandButton.&lt;br /&gt;
&lt;h4&gt;UseMaskColor&lt;/h4&gt;If set to True, the MaskColor property will be used as the transparent colour in the picture used on the CommandButton.  See the MaskColor property for information.&lt;br /&gt;
&lt;h4&gt;Visible&lt;/h4&gt;Determines whether the CommandButton appears on the Form.  I.e. if set to False, the CommandButton will be unavailable to the user - even by trying to set focus to it with the tab key.&lt;br /&gt;
&lt;h4&gt;Width&lt;/h4&gt;Sets the width of the CommandButton.&lt;br /&gt;
&lt;h3&gt;Methods&lt;/h3&gt;&lt;h4&gt;Move&lt;/h4&gt;&lt;i&gt;Left As Single, [Top], [Width], [Height]&lt;/i&gt;&lt;br /&gt;
This method changes the position and optionally the size of the CommandButton.  The following example will move the CommandButton to the top-left of the Form and makes it into a square:&lt;br /&gt;
&lt;table border=&quot;1&quot; class=&quot;vbtable&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;Command1.Move 0, 0, 375, 375&lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;h4&gt;SetFocus&lt;/h4&gt;Sets the focus to the CommandButton.  This means that pressing the Enter key will activate the Click event, even if another CommandButton has it&#39;s Default property set to True.&lt;br /&gt;
&lt;h3&gt;Events&lt;/h3&gt;&lt;h4&gt;Click&lt;/h4&gt;This is probably the most important event for the CommandButton.  It occurs when the user clicks on the CommandButton, or activates it in another way e.g. with the Enter key, Space key, Alt+[Underlined Letter] or Escape key depending on the properties of the CommandButton.&lt;br /&gt;
&lt;table border=&quot;1&quot; class=&quot;vbtable&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;&lt;span style=&quot;color: navy;&quot;&gt;Private Sub&lt;/span&gt; Command1_Click()&lt;br /&gt;
Text3.Text = &lt;span style=&quot;color: navy;&quot;&gt;CStr(&lt;/span&gt;Val(Text1.Text) +       Val(Text2.Text)&lt;span style=&quot;color: navy;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: navy;&quot;&gt;End Sub&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;h4&gt;GotFocus&lt;/h4&gt;Occurs when the CommandButton gets focus either from the Tab key, when it is clicked on by the user or by using the SetFocus method.&lt;br /&gt;
&lt;h4&gt;KeyDown, KeyUp&lt;/h4&gt;&lt;i&gt;KeyCode As Integer, Shift As Integer&lt;/i&gt;&lt;br /&gt;
When the user presses a keyboard key down or releases a key, these events occur.&lt;br /&gt;
&lt;table border=&quot;1&quot; class=&quot;vbtable&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;&lt;span style=&quot;color: navy;&quot;&gt;Private Sub&lt;/span&gt; Command1_KeyDown(KeyCode &lt;span style=&quot;color: navy;&quot;&gt; As       Integer&lt;/span&gt;, Shift &lt;span style=&quot;color: navy;&quot;&gt; As Integer&lt;/span&gt;)&lt;br /&gt;
&lt;span style=&quot;color: navy;&quot;&gt;If&lt;/span&gt; KeyCode = vbKeyBack &lt;span style=&quot;color: navy;&quot;&gt; Then&lt;/span&gt;&lt;br /&gt;
MsgBox &quot;You pressed the backspace key!&quot;&lt;br /&gt;
&lt;span style=&quot;color: navy;&quot;&gt;End If&lt;br /&gt;
End Sub&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;The Shift argument contains the value of the Shift, Control and Alt keys.  This is useful for performing a different action when one of these keys is pressed in combination with another e.g. pressing &#39;A&#39; would be different to pressing &#39;Ctrl+A&#39;.&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; class=&quot;tback&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Constant&lt;/th&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Value&lt;/th&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;34%&quot;&gt;Description&lt;/th&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbShiftMask&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;1&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;34%&quot;&gt;Shift key&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbCtrlMask&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;2&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;34%&quot;&gt;Ctrl key&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbAltMask&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;4&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;34%&quot;&gt;Alt key&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/center&gt;  &lt;br /&gt;
If a combination of these keys are pressed, the Shift argument will contain the sum of all keys pressed e.g. Ctrl+Alt would be 6.&lt;br /&gt;
&lt;table border=&quot;1&quot; class=&quot;vbtable&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;&lt;span style=&quot;color: navy;&quot;&gt;Private Sub&lt;/span&gt; Command1_KeyDown(KeyCode &lt;span style=&quot;color: navy;&quot;&gt; As       Integer&lt;/span&gt;, Shift &lt;span style=&quot;color: navy;&quot;&gt; As Integer&lt;/span&gt;)&lt;br /&gt;
&lt;span style=&quot;color: navy;&quot;&gt;If&lt;/span&gt; Shift = vbCtrlMask + vbShiftMask &lt;span style=&quot;color: navy;&quot;&gt; Then&lt;br /&gt;
&lt;/span&gt;    &lt;span style=&quot;color: navy;&quot;&gt;If&lt;/span&gt; KeyCode = vbKeyA       &lt;span style=&quot;color: navy;&quot;&gt; Then&lt;/span&gt;&lt;br /&gt;
MsgBox &quot;You pressed the Ctrl+Shift+A key combination!&quot;&lt;br /&gt;
&lt;span style=&quot;color: navy;&quot;&gt;End If&lt;br /&gt;
End If&lt;br /&gt;
End Sub&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;h4&gt;KeyPress&lt;/h4&gt;&lt;i&gt;KeyAscii As Integer&lt;/i&gt;&lt;br /&gt;
This event works differently to the KeyDown and KeyUp events in that it detects the actual character (as the ANSI keycode) that is pressed rather than the keyboard key.  E.g.:&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: center;&quot;&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; class=&quot;tback&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;50%&quot;&gt;Key Pressed&lt;/th&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;50%&quot;&gt;Result&lt;/th&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;50%&quot;&gt;s&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;50%&quot;&gt;115&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;50%&quot;&gt;Shift&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;50%&quot;&gt;Nothing&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;50%&quot;&gt;Space&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;50%&quot;&gt;32&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/center&gt;  &lt;br /&gt;
You can use the Chr function to convert the code into a letter e.g. Chr(KeyAscii).  If KeyAscii is set to 0 in this event, this makes the program act as if the key was never pressed.&lt;br /&gt;
&lt;h4&gt;LostFocus&lt;/h4&gt;Occurs when the CommandButton loses focus.&lt;br /&gt;
&lt;h4&gt;MouseDown, MouseUp&lt;/h4&gt;&lt;i&gt;Button As Integer, Shift As Integer, X As Single, Y As Single&lt;/i&gt;&lt;br /&gt;
This event occurs when a mouse button is pressed down or released over a CommandButton.&lt;br /&gt;
&lt;table border=&quot;1&quot; class=&quot;vbtable&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;     &lt;td&gt;Private Sub Command1_MouseUp(Button &lt;span style=&quot;color: navy;&quot;&gt; As Integer&lt;/span&gt;, Shift       &lt;span style=&quot;color: navy;&quot;&gt; As Integer&lt;/span&gt;, X &lt;span style=&quot;color: navy;&quot;&gt; As       Single&lt;/span&gt;, Y &lt;span style=&quot;color: navy;&quot;&gt; As Single&lt;/span&gt;)&lt;br /&gt;
&lt;span style=&quot;color: navy;&quot;&gt;If&lt;/span&gt; Button = vbMiddleButton &lt;span style=&quot;color: navy;&quot;&gt; Then&lt;/span&gt;&lt;br /&gt;
MsgBox &quot;The middle button was pressed on the CommandButton&quot;&lt;br /&gt;
&lt;span style=&quot;color: navy;&quot;&gt;End If&lt;br /&gt;
End Sub&lt;/span&gt;&lt;/td&gt;   &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;The Button argument returns one of the following possible values:&lt;br /&gt;
&lt;br /&gt;
&lt;center&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;table border=&quot;1&quot; class=&quot;tback&quot; style=&quot;margin-left: 0px; margin-right: 0px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Constant&lt;/th&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;Value&lt;/th&gt;       &lt;th style=&quot;text-align: center;&quot; width=&quot;34%&quot;&gt;Description&lt;/th&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbLeftButton&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;1&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;34%&quot;&gt;Left mouse button&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbRightButton&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;2&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;34%&quot;&gt;Right mouse button&lt;/td&gt;     &lt;/tr&gt;
&lt;tr&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;vbMiddleButton&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;33%&quot;&gt;4&lt;/td&gt;       &lt;td style=&quot;text-align: center;&quot; width=&quot;34%&quot;&gt;Middle mouse button&lt;/td&gt;     &lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;/center&gt;  &lt;br /&gt;
The Shift argument works the in same the same way as in the KeyDown and KeyUp events.  The X and Y arguments return the position of the cursor in relation to the CommandButton i.e. the coordinates of the very top-left of the CommandButton are 0, 0.&lt;br /&gt;
The MouseDown event occurs before the Click event and the MouseUp event occurs after the Click event.&lt;br /&gt;
&lt;h3&gt;Other Things to Try&lt;/h3&gt;&lt;h4&gt;Coloured Text&lt;/h4&gt;It is not possible to change the colour of the text of the CommandButton&#39;s text as there is no ForeColor property.  The only way to do it is to create a picture of coloured text and use it as the Picture property.  Remember to set the following properties:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Caption: &quot;&quot; (no text)&lt;/li&gt;
&lt;li&gt;MaskColor: the background colour of the picture if its not already     transparent&lt;/li&gt;
&lt;li&gt;Picture: the picture of the coloured text&lt;/li&gt;
&lt;li&gt;Style: 1 - Graphical&lt;/li&gt;
&lt;li&gt;UseMaskColor: True (if necessary)&lt;/li&gt;
&lt;/ul&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/5541188671736307094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/working-with-command-button.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/5541188671736307094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/5541188671736307094'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/working-with-command-button.html' title='Working with Command Button'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6247775353130374973.post-1485978153771891426</id><published>2010-08-25T12:11:00.000-07:00</published><updated>2010-10-05T00:27:12.881-07:00</updated><title type='text'>Welcome All!!</title><content type='html'>Welcome all. This blog is for those who want to learn VB6......&lt;br /&gt;
&lt;br /&gt;
Here you can find many sample projects and tutorials....&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;!-- Begin BidVertiser code --&gt;
&lt;SCRIPT LANGUAGE=&quot;JavaScript1.1&quot; SRC=&quot;http://bdv.bidvertiser.com/BidVertiser.dbm?pid=339185%26bid=850387&quot; type=&quot;text/javascript&quot;&gt;&lt;/SCRIPT&gt;
&lt;noscript&gt;&lt;a href=&quot;http://www.bidvertiser.com&quot;&gt;online advertising&lt;/a&gt;&lt;/noscript&gt;
&lt;!-- End BidVertiser code --&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vb6sampleproject.blogspot.com/feeds/1485978153771891426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/welcome-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/1485978153771891426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6247775353130374973/posts/default/1485978153771891426'/><link rel='alternate' type='text/html' href='http://vb6sampleproject.blogspot.com/2010/08/welcome-all.html' title='Welcome All!!'/><author><name>Kingson Prisonic</name><uri>http://www.blogger.com/profile/05249816268156726677</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>