{"id":6394,"date":"2015-04-04T21:24:42","date_gmt":"2015-04-04T13:24:42","guid":{"rendered":"http:\/\/www.vbtutor.net\/?page_id=6394"},"modified":"2018-06-22T17:55:32","modified_gmt":"2018-06-22T09:55:32","slug":"visual-basic-2015-lesson-13-using-else","status":"publish","type":"page","link":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-lesson-13-using-else\/","title":{"rendered":"Visual Basic 2015 Lesson 13: Using If&#8230;.Then&#8230;.Else"},"content":{"rendered":"<h4 style=\"text-align: center;\"><a title=\"visual basic 2015 lesson 12\" href=\"http:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-lesson-12-working-string\/\">[Lesson 12] <\/a>&lt;&lt; <a title=\"visual basic 2015 tutorial\" href=\"http:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-tutorial\/\">[Contents]<\/a> &gt;&gt; <a title=\"visual basic 2015 tutorial lesson 14\" href=\"http:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-lesson-14-dealing-multiple-choices-using-select-case\/\">[Lesson 14]<\/a><\/h4>\n<p>In this lesson, we shall learn how to write Visual Basic 2015 code that can make decisions. We can write a Visual Basic 2015 program that can ask the computer to perform a certain task until certain conditions are met. In order to control the program flow and to make decisions, we can\u00a0use the <strong>conditional operators<\/strong> and the<strong> logical operators<\/strong> together with the <strong>If..Then&#8230;Else<\/strong>\u00a0keywords.<\/p>\n<p><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<!-- VB2015 Responsive --><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block;\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"1544369909\" data-ad-format=\"rectangle\"><\/ins><br \/>\n<script>\n(adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h3>13.1 Conditional Operators<\/h3>\n<p>Conditional operators resemble mathematical operators. These operators allow a Visual Basic 2015 program to compare data values and then decide what actions to be taken. They are also known as numerical comparison operators which are used to compare two values to see whether they are equal or one value is greater or less than the other value. The comparison will return a true or false result. These operators are shown in Table 13.1<\/p>\n<h4 style=\"text-align: center;\">Table 13.1: Conditional Operators<\/h4>\n<div style=\"overflow-x:auto;\">\n<table>\n<tbody>\n<tr>\n<th>Operator<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>\u00a0=<\/td>\n<td>\u00a0Equal to<\/td>\n<\/tr>\n<tr>\n<td>\u00a0&gt;<\/td>\n<td>\u00a0Greater than<\/td>\n<\/tr>\n<tr>\n<td>\u00a0&lt;<\/td>\n<td>\u00a0Less than<\/td>\n<\/tr>\n<tr>\n<td>\u00a0&gt;=<\/td>\n<td>\u00a0Equal to or Greater than<\/td>\n<\/tr>\n<tr>\n<td>&lt;=<\/td>\n<td>\u00a0Less than or Equal to<\/td>\n<\/tr>\n<tr>\n<td>\u00a0&lt;&gt;<\/td>\n<td>\u00a0Not equal to<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h3>13.2 Logical Operators<\/h3>\n<p>In certain cases, we might need to make more than one comparisons to arrive at a decision.In this case, using numerical comparison operators alone might not be sufficient and we need to use the logical operators, as shown in Table 13.2.\u00a0Logical\u00a0operators can be used to compare numerical data as well as non-numeric data such as strings. \u00a0In making strings comparison, there are certain rules to follows: Upper case letters are less than lowercase letters, \u201cA\u201d&lt;\u201dB\u201d&lt;\u201dC\u201d&lt;\u201dD\u201d\u2026\u2026.&lt;\u201dZ\u201d and number are less than letters.<\/p>\n<p><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"4768455349\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h4><strong>Table 13.2: Logical Operators<\/strong><\/h4>\n<div style=\"overflow-x:auto;\">\n<table>\n<tbody>\n<tr>\n<th>Operator<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>And<\/td>\n<td>Both sides must be true<\/td>\n<\/tr>\n<tr>\n<td>Or<\/td>\n<td>One side or other must be true<\/td>\n<\/tr>\n<tr>\n<td>Xor<\/td>\n<td>One side or other must be true but not both<\/td>\n<\/tr>\n<tr>\n<td>Not<\/td>\n<td>Negates true<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>13.3 Using the If control structure with the Comparison Operators<\/h3>\n<p>To control the Visual Basic 2015 program flow and to make decisions, we shall use the<strong> If<\/strong> control structure together with the conditional operators and logical operators. There are three types of If control structures, namely <strong>If\u2026.Then<\/strong> statement, <strong>If\u2026.Then\u2026 Else<\/strong> statement and <strong>If\u2026.Then\u2026.ElseIf<\/strong> statement.<\/p>\n<h4><strong>13.3(a) If\u2026.Then Statement<\/strong><\/h4>\n<p>This is the simplest control structure which instructs the computer to perform a certain action specified by the Visual Basic 2015 expression if the condition is true. However, when the condition is false, no action will be performed. The syntax for the if\u2026then.. statement is<\/p>\n<pre style=\"font-size: 110%;\">If condition Then\r\n\r\nVisual Basic 2015 expressions\r\n\r\nEnd If\r\n<\/pre>\n<h4><strong>Example 13.1<\/strong><\/h4>\n<p><span style=\"line-height: 1.714285714; font-size: 1rem;\">In this program, we insert a text box and rename it as txtNum and a button and rename it as OK. We write the code so that when the user runs the program and enter a number that is greater than 100, he or she will see the \u201cYou win a lucky prize\u201d message. On the other hand, if the number entered is less than or equal to 100, the user will not\u00a0see any message.<\/span><\/p>\n<h4><strong>The code<\/strong><\/h4>\n<pre style=\"font-size: 110%;\">Private Sub OK_Click(sender As Object, e As EventArgs) Handles OK.Click<\/pre>\n<p>Dim myNumber As Integer myNumber = TxtNum.Text If myNumber &gt; 100 Then MsgBox(\u201d You win a lucky prize\u201d) End If End Sub<\/p>\n<p>The output is as shown in Figure 13.1 and Figure 13.2<\/p>\n<p><a href=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6403\" src=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg\" alt=\"vb2015_fig13.1\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg 300w, https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1-150x150.jpg 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 13.1<\/strong><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6404\" src=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.2.jpg\" alt=\"vb2015_fig13.2\" width=\"181\" height=\"155\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 13.2<\/strong><\/p>\n<h4><strong>13.3(b) If\u2026.Then\u2026Else Statement<\/strong><\/h4>\n<p>As we have seen in example 13.1, using \u00a0If\u2026.Then statement does not provide alternative output for the user. In order to provide an alternative output, we need to use the <strong>If\u2026.Then\u2026Else<\/strong> Statement. This control structure will ask the computer to perform a certain action specified by the Visual Basic 2015 expression if the condition is met. And when the condition is false , we \u00a0usean alternative action will be executed. The syntax for the if\u2026then&#8230; Else statement is<\/p>\n<pre style=\"font-size: 110%;\">If condition Then\r\nVisual Basic 2015 expression 1\r\nElse\r\nVisual Basic 2015 expression 2\r\nEnd If\r\n<\/pre>\n<h4><strong>Example 13.2<\/strong><\/h4>\n<p>We modified the code in Example 13.1 by adding the Else keyword and an alternative expression MsgBox(&#8220;Sorry, You did not win any prize\u201d).\u00a0When you run the program and enter a number that is greater than 100, the message\u00a0\u201cCongratulation! You win a lucky prize\u201d will be shown.Otherwise, you will see the \u201cSorry, You did not win any prize\u201d\u00a0message, as shown in Figure 13.3<\/p>\n<h4><strong>The code<\/strong><\/h4>\n<pre style=\"font-size: 110%;\">Private Sub OK_Click(sender As Object, e As EventArgs) Handles OK.Click\r\n\r\nDim myNumber As Integer\r\nmyNumber = TxtNum.Text\r\nIf myNumber &gt; 100 Then\r\nMsgBox(\u00a0\u201d Congratulation! You win a lucky prize\u201d)\r\nElse\r\nMsgBox(\u00a0\u201d Sorry, You did not win any prize\u201d)\r\nEnd If\r\nEnd Sub\r\n<\/pre>\n<p><a href=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6405\" src=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.3.jpg\" alt=\"vb2015_fig13.3\" width=\"237\" height=\"155\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 13.3<\/strong><\/p>\n<h4><strong>Example 13.3<\/strong><\/h4>\n<p>In this program, we use the logical operator <strong>And<\/strong> besides using the conditional operators. This means that both conditions must be met otherwise the second block of code will be executed. In this example, the number entered must be more than 100 and the age must be more than 60 in order to win a lucky prize, any one of the above conditions not fulfilled will disqualify the user from winning a prize. You need to add another text box for the user to enter his or her age. The output is as shown in Figure 13.4<\/p>\n<pre style=\"font-size: 110%;\">Private Sub OK_Click(sender As Object, e As EventArgs) Handles OK.Click\r\nDim myNumber, MyAge As Integer\r\nmyNumber = TxtNum.Text\r\nMyAge = TxtAge.Text\r\n\r\nIf myNumber &gt; 100 And MyAge &gt; 60 Then\r\nMsgBox(\" Congratulation! You win a lucky prize\")\r\nElse\r\nMsgBox(\"Sorry, You did not win any prize\")\r\nEnd If\r\nEnd Sub\r\n<\/pre>\n<p><a href=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.4.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6407\" src=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.4.jpg\" alt=\"vb2015_fig13.4\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.4.jpg 300w, https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.4-150x150.jpg 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 13.4<\/strong><\/p>\n<p><strong>13.3(c) If\u2026.Then\u2026ElseIf Statement<\/strong><\/p>\n<p>In circumstances where there are more than two alternative conditions, using just If\u2026.Then\u2026.Else statement will not be enough. In this case, we can use the<strong> If\u2026.Then\u2026ElseIf<\/strong> Statement.The general structure for the if..then.. Else statement is<\/p>\n<pre style=\"font-size: 110%;\">If condition Then\r\nVisual Basic 2015 expression1\r\nElseIf condition Then\r\nVisual Basic 2015 expression2\r\nElseIf condition Then\r\nVisual Basic 2015 expression3\r\n\r\n..\r\n\r\nElse\r\n\r\nVisual Basic 2015 expression4\r\nEnd If\r\n<\/pre>\n<h4>Example 13.4<\/h4>\n<p>This program can compute grade for the mark entered by the user. Is uses several ElseIf statements and the logical operator <strong>And\u00a0<\/strong>to achieve the purpose. The outputs are as shown in Figure 13.5 and Figure 13.6<\/p>\n<pre style=\"font-size: 110%;\">Private Sub OK_Click(sender As Object, e As EventArgs) Handles OK.Click\r\nDim Mark As Integer\r\nDim Grade As String\r\n\r\nMark = TxtMark.Text\r\nIf Mark &gt;= 80 And Mark &lt;= 100 Then\r\nGrade = \"A\"\r\n\r\nElseIf Mark &gt;= 60 And Mark &lt; 80 Then\r\nGrade = \"B\"\r\n\r\nElseIf Mark &gt;= 40 And Mark &lt; 60\r\nGrade = \"C\"\r\n\r\nElseIf Mark &gt;= 0 And Mark &lt; 40\r\nGrade = \"D\"\r\n\r\nElse\r\nGrade = \"Out of Range\"\r\n\r\nEnd If\r\n\r\nMsgBox(\"You Grade is \" &amp; Grade)\r\n\r\nEnd Sub\r\n<\/pre>\n<p><a href=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.5.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6410\" src=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.5.jpg\" alt=\"vb2015_fig13.5\" width=\"300\" height=\"300\" srcset=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.5.jpg 300w, https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.5-150x150.jpg 150w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 13.5<\/strong><\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.6.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-6411\" src=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.6.jpg\" alt=\"vb2015_fig13.6\" width=\"170\" height=\"155\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong>Figure 13.6<\/strong><\/p>\n<p><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block;\" data-ad-format=\"autorelaxed\" data-ad-client=\"ca-pub-3033628290023372\" data-ad-slot=\"1492877908\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h4 style=\"text-align: center;\"><a title=\"visual basic 2015 lesson 12\" href=\"http:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-lesson-12-working-string\/\">[Lesson 12] <\/a>&lt;&lt; <a title=\"visual basic 2015 tutorial\" href=\"http:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-tutorial\/\">[Contents]<\/a> &gt;&gt; <a title=\"visual basic 2015 tutorial lesson 14\" href=\"http:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-lesson-14-dealing-multiple-choices-using-select-case\/\">[Lesson 14]<\/a><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>[Lesson 12] &lt;&lt; [Contents] &gt;&gt; [Lesson 14] In this lesson, we shall learn how to write Visual Basic 2015 code that can make decisions. We can write a Visual Basic 2015 program that can ask the computer to perform a certain task until certain conditions are met. In order to control the program flow and &hellip; <a href=\"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-lesson-13-using-else\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Visual Basic 2015 Lesson 13: Using If&#8230;.Then&#8230;.Else<\/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-6394","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>Visual Basic 2015 Lesson 13: Using If....Then....Else - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB<\/title>\n<meta name=\"description\" content=\"This article illustrates how to use If...Then...Else control structure for making decisions in visual basic 2015\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Visual Basic 2015 Lesson 13: Using If....Then....Else - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\" \/>\n<meta property=\"og:description\" content=\"This article illustrates how to use If...Then...Else control structure for making decisions in visual basic 2015\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html\" \/>\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=\"2018-06-22T09:55:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.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=\"5 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\/visual-basic-2015-lesson-13-using-else\/\",\"url\":\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html\",\"name\":\"Visual Basic 2015 Lesson 13: Using If....Then....Else - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB\",\"isPartOf\":{\"@id\":\"https:\/\/www.vbtutor.net\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#primaryimage\"},\"image\":{\"@id\":\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg\",\"datePublished\":\"2015-04-04T13:24:42+00:00\",\"dateModified\":\"2018-06-22T09:55:32+00:00\",\"description\":\"This article illustrates how to use If...Then...Else control structure for making decisions in visual basic 2015\",\"breadcrumb\":{\"@id\":\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#primaryimage\",\"url\":\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg\",\"contentUrl\":\"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg\",\"width\":300,\"height\":300},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vbtutor.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Visual Basic 2015 Lesson 13: Using If&#8230;.Then&#8230;.Else\"}]},{\"@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":"Visual Basic 2015 Lesson 13: Using If....Then....Else - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","description":"This article illustrates how to use If...Then...Else control structure for making decisions in visual basic 2015","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":"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html","og_locale":"en_US","og_type":"article","og_title":"Visual Basic 2015 Lesson 13: Using If....Then....Else - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","og_description":"This article illustrates how to use If...Then...Else control structure for making decisions in visual basic 2015","og_url":"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html","og_site_name":"Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","article_publisher":"https:\/\/www.facebook.com\/Vbtutor","article_modified_time":"2018-06-22T09:55:32+00:00","og_image":[{"url":"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_site":"@liewvk","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vbtutor.net\/index.php\/visual-basic-2015-lesson-13-using-else\/","url":"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html","name":"Visual Basic 2015 Lesson 13: Using If....Then....Else - Learn Visual Basic Programming \u2013 VB.NET, VBA &amp; Classic VB","isPartOf":{"@id":"https:\/\/www.vbtutor.net\/#website"},"primaryImageOfPage":{"@id":"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#primaryimage"},"image":{"@id":"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#primaryimage"},"thumbnailUrl":"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg","datePublished":"2015-04-04T13:24:42+00:00","dateModified":"2018-06-22T09:55:32+00:00","description":"This article illustrates how to use If...Then...Else control structure for making decisions in visual basic 2015","breadcrumb":{"@id":"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#primaryimage","url":"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg","contentUrl":"https:\/\/www.vbtutor.net\/wordpress\/wp-content\/uploads\/2015\/04\/vb2015_fig13.1.jpg","width":300,"height":300},{"@type":"BreadcrumbList","@id":"http:\/\/www.vbtutor.net\/vb2015\/vb2015_lesson13.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vbtutor.net\/"},{"@type":"ListItem","position":2,"name":"Visual Basic 2015 Lesson 13: Using If&#8230;.Then&#8230;.Else"}]},{"@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\/6394","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=6394"}],"version-history":[{"count":54,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages\/6394\/revisions"}],"predecessor-version":[{"id":13028,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/pages\/6394\/revisions\/13028"}],"wp:attachment":[{"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/media?parent=6394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/categories?post=6394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vbtutor.net\/index.php\/wp-json\/wp\/v2\/tags?post=6394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}