{"id":3208,"date":"2013-05-26T10:15:30","date_gmt":"2013-05-26T02:15:30","guid":{"rendered":"http:\/\/www.vbtutor.net\/?page_id=3208"},"modified":"2017-10-16T19:12:38","modified_gmt":"2017-10-16T11:12:38","slug":"scientific-calculator-created-using-visual-basic-6","status":"publish","type":"page","link":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/","title":{"rendered":"Scientific Calculator Created Using Visual Basic"},"content":{"rendered":"<p style=\"text-align: center;\"><strong><a href=\"http:\/\/www.vbtutor.net\/VB_Sample\/sample.html\">Back to VB6 Samples Codes<\/a><\/strong><\/p>\n<p>This is a calculator that resembles a typical scientific calculator , albeit a simpler version. In our version, we have only included the trigonometric functions and the logarithmic functions. The reason of creating a simpler version of the calculator is to help users to learn the programming concepts in a gradual manner and not to confuse them especially those who are learning to program in Visual Basic.<\/p>\n<p>To design the interface, we just to need to modify the interface of the <a href=\"http:\/\/www.vbtutor.net\/VB_Sample\/calculator.htm\">basic calculator<\/a> that we have created earlier using Visual Basic 6. \u00a0In this calculator, we have added five more buttons, they are Sin, Cos, Tan, Log and Ln. \u00a0The common trigonometric functions in Visual Basic 6 are Sin, Cos, Tan and Atn.<\/p>\n<p>a) Sin is the function that computes the value of sine of an angle in radian.<br \/>\nb) Cos is the function that computes the value of cosine of an angle in radian.<br \/>\nc) Tan is the function that computes the value of tangent of an angle in radian.<br \/>\nd) Atn is the function that computes the value of arc tangent of an angle in radian.<\/p>\n<p>Log computes the value of logarithm to base 10 whilst Ln computes the value of natural logarithm.<\/p>\n<p>An angle in degree has to be converted to radian before it can be calculated by the above trigonometric functions. From high school mathematics, we know that \u03c0 radian is equivalent to 180\u00b0; which means 1 radian is equivalent to \u03c0 divided by 180. Therefore, in order to convert an angle x from degree to radian, we have to multiply x by (\u03c0\/180). However, there is a small problem because it is rather difficult to obtain the precise value of \u03c0, fortunately, there is a way to do it in VB. First of all, we know that an arc tangent of 1 will return the value of 45\u00b0 which is \u03c0\/4 radian. So, to obtain the value of \u03c0, just multiply the arc tangent of 1 with 4. Now, we are ready to enter the code for all the above additional buttons.<\/p>\n<p>For the Sin button, enter the following code:<\/p>\n<p>Private Sub CmdSin_Click()<\/p>\n<p>sinx = Round(Sin(displayValue * 4 * Atn(1) \/ 180), 4)<br \/>\npanel.Caption = sinx<\/p>\n<p>End Sub<\/p>\n<p>* The Round function is to correct the output to certain number of decimal places.<\/p>\n<p>For the Cos button, enter the following code:<\/p>\n<p>Private Sub CmdCos_Click()<\/p>\n<p>cosx = Round(Cos(displayValue * 4 * Atn(1) \/ 180), 4)<br \/>\npanel.Caption = cosx<\/p>\n<p>End Sub<\/p>\n<p>For the Tan button, enter the following code:<\/p>\n<p>Private Sub CmdTan_Click()<\/p>\n<p>tanx = Round(Tan(displayValue * 4 * Atn(1) \/ 180), 4)<br \/>\npanel.Caption = tanx<\/p>\n<p>End Sub<\/p>\n<p>For the Ln button, enter the following code:<\/p>\n<p>Private Sub CmdLn_Click()<br \/>\npanel.Caption = Log(displayValue)<br \/>\nEnd Sub<\/p>\n<p>and for the Log button, enter the following code:<\/p>\n<p>Private Sub CmdLog_Click()<br \/>\npanel.Caption = Log(displayValue) \/ Log(10)<br \/>\nEnd Sub<\/p>\n<p>The interface is shown below:<\/p>\n<figure id=\"attachment_3205\" aria-describedby=\"caption-attachment-3205\" style=\"width: 388px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-3205\" alt=\"Scientific Calculator created using Visual Basic 6\" src=\"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg\" width=\"388\" height=\"382\" \/><\/a><figcaption id=\"caption-attachment-3205\" class=\"wp-caption-text\">Scientific Calculator created using Visual Basic 6<\/figcaption><\/figure>\n<p style=\"text-align: center;\"><strong><a href=\"http:\/\/www.vbtutor.net\/VB_Sample\/sample.html\">Back to VB6 Samples Codes<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Back to VB6 Samples Codes This is a calculator that resembles a typical scientific calculator , albeit a simpler version. In our version, we have only included the trigonometric functions and the logarithmic functions. The reason of creating a simpler version of the calculator is to help users to learn the programming concepts in a &hellip; <a href=\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Scientific Calculator Created Using Visual Basic<\/span><\/a><\/p>\n","protected":false},"author":23013,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-3208","page","type-page","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Scientific Calculator Created Using Visual Basic - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB<\/title>\n<meta name=\"description\" content=\"This article illustrates how to create a scientific calculator using Visual Basic 6\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Scientific Calculator Created Using Visual Basic - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\" \/>\n<meta property=\"og:description\" content=\"This article illustrates how to create a scientific calculator using Visual Basic 6\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Vbtutor\" \/>\n<meta property=\"article:modified_time\" content=\"2017-10-16T11:12:38+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@liewvk\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/\",\"url\":\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/\",\"name\":\"Scientific Calculator Created Using Visual Basic - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\",\"isPartOf\":{\"@id\":\"https:\/\/www.vbtutor.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg\",\"datePublished\":\"2013-05-26T02:15:30+00:00\",\"dateModified\":\"2017-10-16T11:12:38+00:00\",\"description\":\"This article illustrates how to create a scientific calculator using Visual Basic 6\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#primaryimage\",\"url\":\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg\",\"contentUrl\":\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg\",\"width\":388,\"height\":382,\"caption\":\"Scientific Calculator created using Visual Basic 6\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vbtutor.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scientific Calculator Created Using Visual Basic\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vbtutor.net\/#website\",\"url\":\"https:\/\/www.vbtutor.net\/\",\"name\":\"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\",\"description\":\"Start learning Visual Basic from beginner to advanced. Includes VB.NET, VBA, and classic VB tutorials for students and professionals.\",\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Scientific Calculator Created Using Visual Basic - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","description":"This article illustrates how to create a scientific calculator using Visual Basic 6","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/","og_locale":"en_US","og_type":"article","og_title":"Scientific Calculator Created Using Visual Basic - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","og_description":"This article illustrates how to create a scientific calculator using Visual Basic 6","og_url":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/","og_site_name":"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","article_publisher":"https:\/\/www.facebook.com\/Vbtutor","article_modified_time":"2017-10-16T11:12:38+00:00","og_image":[{"url":"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_site":"@liewvk","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/","url":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/","name":"Scientific Calculator Created Using Visual Basic - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","isPartOf":{"@id":"https:\/\/www.vbtutor.net\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#primaryimage"},"image":{"@id":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#primaryimage"},"thumbnailUrl":"http:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg","datePublished":"2013-05-26T02:15:30+00:00","dateModified":"2017-10-16T11:12:38+00:00","description":"This article illustrates how to create a scientific calculator using Visual Basic 6","breadcrumb":{"@id":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#primaryimage","url":"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg","contentUrl":"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2013\/05\/Cal_Sctific.jpg","width":388,"height":382,"caption":"Scientific Calculator created using Visual Basic 6"},{"@type":"BreadcrumbList","@id":"https:\/\/www.vbtutor.net\/index.php\/scientific-calculator-created-using-visual-basic-6\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vbtutor.net\/"},{"@type":"ListItem","position":2,"name":"Scientific Calculator Created Using Visual Basic"}]},{"@type":"WebSite","@id":"https:\/\/www.vbtutor.net\/#website","url":"https:\/\/www.vbtutor.net\/","name":"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","description":"Start learning Visual Basic from beginner to advanced. Includes VB.NET, VBA, and classic VB tutorials for students and professionals.","inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages\/3208","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/users\/23013"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/comments?post=3208"}],"version-history":[{"count":17,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages\/3208\/revisions"}],"predecessor-version":[{"id":11925,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages\/3208\/revisions\/11925"}],"wp:attachment":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/media?parent=3208"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/categories?post=3208"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/tags?post=3208"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}