{"id":64005,"date":"2022-06-21T05:50:14","date_gmt":"2022-06-21T05:50:14","guid":{"rendered":"https:\/\/itsourcecode.com\/?p=64005"},"modified":"2023-11-21T03:11:47","modified_gmt":"2023-11-21T03:11:47","slug":"vb-net-variables","status":"publish","type":"post","link":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/","title":{"rendered":"VB.net Variables &#8211; Declaration and Initialization of Variables in VB"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"h-vb-net-variables\"><strong>VB.net Variables<\/strong><\/h2>\n\n\n\n<p>A <strong>VB.net variables<\/strong> is nothing more than a name for a storage space that our programs can access. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>In <strong>VB.net<\/strong>, each variable has a type that governs the memory size and layout, the range of values that may be stored within that memory, and the set of operations that can be applied to the variable.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>A <strong>variable<\/strong> is used in VB.NET to store a value that can be used later in the program. We&#8217;ll learn how to declare and initialize variables in this section.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-a-variable-in-visual-basic\"><strong>What is a Variable in Visual Basic?<\/strong><\/h2>\n\n\n\n<p>A <strong>variable<\/strong> is a short name for the value of a specific data type that is stored in computer memory. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Each variable in <strong>VB.net<\/strong> has a specific data type that determines its <strong><em>size<\/em><\/strong>, <strong><em>range<\/em><\/strong>, and <strong><em>fixed memory location<\/em><\/strong>. <\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>In any programming language, we can use variables to execute multiple operations and alter data values.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>The basic value types provided in <strong><a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/visual-basic\/\">VB.net<\/a><\/strong> can be categorized as:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Type<\/th><th>Example<\/th><\/tr><tr><td>Integral types<\/td><td>SByte, Byte, Short, UShort, Integer, UInteger, Long, ULong and Char<\/td><\/tr><tr><td>Floating point types<\/td><td>Single and Double<\/td><\/tr><tr><td>Decimal types<\/td><td>Decimal<\/td><\/tr><tr><td>Boolean types<\/td><td>True or False values, as assigned<\/td><\/tr><tr><td>Date types<\/td><td>Date<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\"><strong><em>Basic Value Types<\/em><\/strong><\/figcaption><\/figure>\n\n\n\n<p>VB.net also allows defining other value types of variables like <strong>Enum<\/strong> and reference types of variables like Class.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-vb-net-variables-declaration\"><strong>VB.net Variables Declaration<\/strong><\/h2>\n\n\n\n<p>The <strong>declaration of a variable<\/strong> is simple and requires a variable name and data type followed by a Dim. A Dim is used in Class, Module, structure, Sub, and <strong><em>procedure<\/em><\/strong>.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>The syntax for variable declaration in VB.Net is:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'Syntax for variable declaration in VB.Net'\n\n&#91; &lt; attributelist &gt; ] &#91; accessmodifier ] &#91;&#91; Shared ] &#91; Shadows ] | &#91; Static ]]\n&#91; ReadOnly ] Dim &#91; WithEvents ] variablelist\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-attributelist\"><strong>1. attributelist<\/strong><\/h3>\n\n\n\n<p><strong><em>attributelist<\/em><\/strong> is a list of attributes that apply to the variable. Optional.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-accessmodifier\"><strong>2. accessmodifier<\/strong><\/h3>\n\n\n\n<p><strong><em>accessmodifier<\/em><\/strong> defines the access levels of the variables, it has values as &#8211; Public, Protected, Friend, Protected Friend and Private. Optional.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-3-shared\"><strong>3. Shared<\/strong><\/h3>\n\n\n\n<p><strong><em>Shared<\/em><\/strong> declares a shared variable, which is not associated with any specific instance of a class or structure, rather available to all the instances of the class or structure. Optional.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-4-shadows\"><strong>4. Shadows<\/strong><\/h3>\n\n\n\n<p><strong><em>Shadows<\/em><\/strong> indicate that the variable re-declares and hides an identically named element, or set of overloaded elements, in a base class. Optional.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-5-static\"><strong>5. Static<\/strong><\/h3>\n\n\n\n<p><strong><em>Static<\/em><\/strong> indicates that the variable will retain its value, even after termination of the procedure in which it is declared. Optional.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-6-readonly\"><strong>6. ReadOnly<\/strong><\/h3>\n\n\n\n<p><strong><em>ReadOnly<\/em><\/strong> means the variable can be read, but not written. Optional.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-7-withevents\"><strong>7. WithEvents<\/strong><\/h3>\n\n\n\n<p><strong><em>WithEvents<\/em><\/strong> specifies that the variable is used to respond to events raised by the instance assigned to the variable. Optional.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-8-variablelist\"><strong>8. Variablelist<\/strong><\/h3>\n\n\n\n<p><strong><em>Variablelist<\/em><\/strong> provides the list of variables declared.<\/p>\n\n\n\n<p><strong>Each variable in the variable list has the following syntax and parts<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'syntax for each variable in the variable list'\n\nvariablename&#91; ( &#91; boundslist ] ) ] &#91; As &#91; New ] datatype ] &#91; = initializer ]\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-variablename\"><strong>variablename<\/strong><\/h4>\n\n\n\n<p><strong><em>variablename<\/em><\/strong> \u2212 is the name of the variable.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-boundslist\"><strong>boundslist<\/strong><\/h4>\n\n\n\n<p><strong><em>boundslist<\/em><\/strong> \u2212 optional. It provides list of bounds of each dimension of an array variable.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-new\"><strong>New<\/strong><\/h4>\n\n\n\n<p><strong><em>New<\/em><\/strong> \u2212 optional. It creates a new instance of the class when the Dim statement runs.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-datatype\"><strong>datatype<\/strong><\/h4>\n\n\n\n<p><strong><em>datatype<\/em><\/strong> \u2212 Required if Option Strict is On. It specifies the data type of the variable.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-initializer\"><strong>initializer<\/strong><\/h4>\n\n\n\n<p><strong><em>initializer<\/em><\/strong> \u2212 Optional if New is not specified. An expression that is evaluated and assigned to the variable when it is created.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Some valid variable declarations along with their definition are shown here:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'variable declarations along with their definition'\n\nDim StudentID As Integer\nDim StudentName As String\nDim Salary As Double\nDim count1, count2 As Integer\nDim status As Boolean\nDim exitButton As New System.Windows.Forms.Button\nDim lastTime, nextTime As Date\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-variable-initialization-in-vb-net\"><strong>Variable Initialization in VB.net<\/strong><\/h2>\n\n\n\n<p><strong>Variables in VB.net<\/strong> are initialized (assigned a value) with an equal sign followed by a constant expression. <\/p>\n\n\n\n<p>The general form of initialization is:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/general form of initialization\n\nvariable_name = value;\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>For example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'variable initialization'\n\nDim pi As Double\npi = 3.14159\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>You can initialize a variable at the time of declaration as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'initializing the variable at the time'\n\nDim StudentID As Integer = 100\nDim StudentName As String = \"Angel Jude Suarez\"\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-example-code-for-the-various-vb-net-variable-types\"><strong>Example Code for the various VB.net Variable Types<\/strong><\/h2>\n\n\n\n<p>Try the following example which makes use of various <strong>vb.net types of variable<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'following example of various types of variables'\n\nModule variablesNdataypes\n   Sub Main()\n      Dim a As Short\n      Dim b As Integer\n      Dim c As Double\n      \n      a = 10\n      b = 20\n      c = a + b\n      Console.WriteLine(\"a = {0}, b = {1}, c = {2}\", a, b, c)\n      Console.ReadLine()\n   End Sub\nEnd Module\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>When the above code is compiled and executed, it produces the following result:<\/p>\n\n\n\n<p class=\"has-base-3-color has-contrast-background-color has-text-color has-background\">a = 10, b = 20, c = 30<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>You can test the above example here! \u27a1&nbsp;<a href=\"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-online-compiler-and-ide\/\">VB.net Online Compiler<\/a><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-accepting-values-from-user\"><strong>Accepting Values from User<\/strong><\/h2>\n\n\n\n<p>The Console class in the System namespace provides a function <strong>ReadLine<\/strong> for accepting input from the user and storing it into a variable.<\/p>\n\n\n\n<p><strong>For example:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'accepting user input'\n\nDim message As String\nmessage = Console.ReadLine\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>The following example demonstrates it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nModule variablesNdataypes\n   Sub Main()\n      Dim message As String\n      Console.Write(\"Enter message: \")\n      message = Console.ReadLine\n      Console.WriteLine()\n      Console.WriteLine(\"Your Message: {0}\", message)\n      Console.ReadLine()\n   End Sub\nEnd Module\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>When the above code is compiled and executed, it produces the following result (assume the user inputs Hello IT SOURCECODERS!)<\/p>\n\n\n\n<p class=\"has-base-3-color has-contrast-background-color has-text-color has-background\">Enter message: Hello IT SOURCECODERS!<br>Your Message: Hello IT SOURCECODERS!<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p class=\"has-medium-font-size\"><strong>You can test the above example here! \u27a1&nbsp;<a href=\"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-online-compiler-and-ide\/\">VB.net Online Compiler<\/a><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-lvalues-and-rvalues\"><strong>Lvalues and Rvalues<\/strong><\/h2>\n\n\n\n<p>There are two kinds of expressions:<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-lvalue\"><strong>1. lvalue<\/strong><\/h3>\n\n\n\n<p><strong><em>lvalue<\/em><\/strong> \u2212 An expression that is an lvalue may appear as either the left-hand or right-hand side of an assignment.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-rvalue\"><strong>2. rvalue<\/strong><\/h3>\n\n\n\n<p><strong><em>rvalue<\/em><\/strong> \u2212 An expression that is an rvalue may appear on the right- but not the left-hand side of an assignment.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Variables<\/strong> are <strong>lvalues<\/strong> and so may appear on the left-hand side of an assignment. Numeric literals are <strong>rvalues<\/strong> and so may not be assigned and can not appear on the left-hand side.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Following is a valid statement:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Dim g As Integer = 20<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>But the following is not a valid statement and would generate a compile-time error<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>20 = g<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-summary\"><strong>Summary<\/strong><\/h2>\n\n\n\n<p>In this tutorial we&#8217;ve successfully discussed the VB.net Variables and how to declare a variable in a program, also we discussed how to store any data type Data in a variable name.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div class=\"wp-block-columns is-not-stacked-on-mobile tw-mb-0 tw-mt-0 tw-gutter-large tw-stretched-link is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"tw-mt-0 tw-mb-0\" style=\"font-size:22px;font-style:normal;font-weight:600\"><strong>PREVIOUS<\/strong><\/p>\n\n\n\n<div class=\"wp-block-cover tw-mt-0 tw-mb-0 is-style-tw-rounded-corners tw-stretched-link tw-hover-show-text tw-ratio-16-9\"><span aria-hidden=\"true\" class=\"wp-block-cover__background has-background-dim-70 has-background-dim\"><\/span><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"900\" class=\"wp-block-cover__image-background wp-image-63994\" alt=\"VB NET Data Types with Example\" src=\"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Data-Types-with-Example.png\" style=\"object-position:50% 50%\" data-object-fit=\"cover\" data-object-position=\"50% 50%\" srcset=\"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Data-Types-with-Example.png 1460w, https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Data-Types-with-Example-300x185.png 300w, https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Data-Types-with-Example-1024x631.png 1024w, https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Data-Types-with-Example-768x473.png 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<p class=\"has-text-align-center tw-mt-0 tw-mb-0 has-base-3-color has-text-color\" style=\"font-size:30px\"><strong><a href=\"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-data-type-with-example-tutorial\/\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-base-3-color\">Data Types<\/mark><\/a><\/strong><\/p>\n<\/div><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"has-text-align-right tw-mt-0 tw-mb-0\" style=\"font-size:22px;font-style:normal;font-weight:600\"><strong>NEXT <\/strong><\/p>\n\n\n\n<div class=\"wp-block-cover tw-mt-0 tw-mb-0 is-style-tw-rounded-corners tw-stretched-link tw-hover-show-text tw-ratio-16-9\"><span aria-hidden=\"true\" class=\"wp-block-cover__background has-background-dim-70 has-background-dim\"><\/span><img loading=\"lazy\" decoding=\"async\" width=\"1460\" height=\"900\" class=\"wp-block-cover__image-background wp-image-64282\" alt=\"VB NET Constants\" src=\"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Constants.png\" data-object-fit=\"cover\" srcset=\"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Constants.png 1460w, https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Constants-300x185.png 300w, https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Constants-1024x631.png 1024w, https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Constants-768x473.png 768w\" sizes=\"auto, (max-width: 1460px) 100vw, 1460px\" \/><div class=\"wp-block-cover__inner-container is-layout-flow wp-block-cover-is-layout-flow\">\n<p class=\"has-text-align-center tw-mt-0 tw-mb-0 has-base-3-color has-text-color\" style=\"font-size:30px\"><strong><a href=\"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-constants\/\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-base-3-color\">Constants<\/mark><\/a><\/strong><\/p>\n<\/div><\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>VB.net Variables A VB.net variables is nothing more than a name for a storage space that our programs can access. In VB.net, each variable has a type that governs the &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"VB.net Variables &#8211; Declaration and Initialization of Variables in VB\" class=\"read-more button\" href=\"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#more-64005\" aria-label=\"Read more about VB.net Variables &#8211; Declaration and Initialization of Variables in VB\">Read more<\/a><\/p>\n","protected":false},"author":1767,"featured_media":64169,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[79986,79983,79988,79984,79987,79982,79990,79991,79985,79989],"class_list":["post-64005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-basic-tutorial","tag-how-to-declare-a-variable-in-vb-net","tag-how-to-declare-global-variable-in-vb-net","tag-object-variable-or-with-block-variable-not-set-vb-net","tag-variable-declaration-in-vb-net","tag-variable-in-vb-net-in-hindi","tag-variables-in-vb-net-2","tag-vb-net-environment-variables","tag-vb-net-public-variable","tag-vb-net-session-variable","tag-what-is-variable-in-vb-net","resize-featured-image"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>VB.net Variables - Declaration and Initialization of Variables in VB<\/title>\n<meta name=\"description\" content=\"Learn on How To Declare a VB.net Variable, In this tutorial you can learn on how to store the Data in a Variable name using Visual Basic...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"VB.net Variables - Declaration and Initialization of Variables in VB\" \/>\n<meta property=\"og:description\" content=\"Learn on How To Declare a VB.net Variable, In this tutorial you can learn on how to store the Data in a Variable name using Visual Basic...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/\" \/>\n<meta property=\"og:site_name\" content=\"Itsourcecode.com\" \/>\n<meta property=\"article:published_time\" content=\"2022-06-21T05:50:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-21T03:11:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Variables.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1460\" \/>\n\t<meta property=\"og:image:height\" content=\"900\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"angel jude suarez\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"angel jude suarez\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/\"},\"author\":{\"name\":\"angel jude suarez\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/dafb6a91b43e60537c56e3e1d227d460\"},\"headline\":\"VB.net Variables &#8211; Declaration and Initialization of Variables in VB\",\"datePublished\":\"2022-06-21T05:50:14+00:00\",\"dateModified\":\"2023-11-21T03:11:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/\"},\"wordCount\":838,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/ad9e0497e03b85a9ca299d935298f5dc\"},\"image\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/VB-NET-Variables.png\",\"keywords\":[\"how to declare a variable in vb net\",\"how to declare global variable in vb net\",\"object variable or with block variable not set vb net\",\"variable declaration in vb net\",\"variable in vb net in hindi\",\"variables in vb net\",\"vb net environment variables\",\"vb net public variable\",\"vb net session variable\",\"what is variable in vb net\"],\"articleSection\":[\"VB.NET Tutorial\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/\",\"name\":\"VB.net Variables - Declaration and Initialization of Variables in VB\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/VB-NET-Variables.png\",\"datePublished\":\"2022-06-21T05:50:14+00:00\",\"dateModified\":\"2023-11-21T03:11:47+00:00\",\"description\":\"Learn on How To Declare a VB.net Variable, In this tutorial you can learn on how to store the Data in a Variable name using Visual Basic...\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/#primaryimage\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/VB-NET-Variables.png\",\"contentUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/VB-NET-Variables.png\",\"width\":1460,\"height\":900,\"caption\":\"VB NET Variables\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/tutorials\\\/visual-basic-tutorial\\\/vb-net-variables\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/itsourcecode.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"VB.net Variables &#8211; Declaration and Initialization of Variables in VB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#website\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/\",\"name\":\"Itsourcecode.com\",\"description\":\"Partner In Your Coding Journey!\",\"publisher\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/ad9e0497e03b85a9ca299d935298f5dc\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/itsourcecode.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/ad9e0497e03b85a9ca299d935298f5dc\",\"name\":\"itsourcecode\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/IT-SOURCECODE_ICON-07.jpg\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/IT-SOURCECODE_ICON-07.jpg\",\"contentUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/IT-SOURCECODE_ICON-07.jpg\",\"width\":409,\"height\":409,\"caption\":\"itsourcecode\"},\"logo\":{\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/IT-SOURCECODE_ICON-07.jpg\"},\"description\":\"Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!\",\"sameAs\":[\"https:\\\/\\\/itsourcecode.com\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/#\\\/schema\\\/person\\\/dafb6a91b43e60537c56e3e1d227d460\",\"name\":\"angel jude suarez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/litespeed\\\/avatar\\\/49f87b924bdd4e5fcbc3635ed3f7af29.jpg?ver=1776429718\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/litespeed\\\/avatar\\\/49f87b924bdd4e5fcbc3635ed3f7af29.jpg?ver=1776429718\",\"contentUrl\":\"https:\\\/\\\/itsourcecode.com\\\/wp-content\\\/litespeed\\\/avatar\\\/49f87b924bdd4e5fcbc3635ed3f7af29.jpg?ver=1776429718\",\"caption\":\"angel jude suarez\"},\"description\":\"Hello programmers, I'm Angel Jude Reyes Suarez, a student and a programmer of different programming languages like Python, Java, JavaScript, PHP, C, C++, Vb.net, and MySQL. and I have also knowledge in developing system or websites from Front-End to Back-End. and also a writer of itsourcecode.com.\",\"url\":\"https:\\\/\\\/itsourcecode.com\\\/author\\\/angeljudesuarez\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"VB.net Variables - Declaration and Initialization of Variables in VB","description":"Learn on How To Declare a VB.net Variable, In this tutorial you can learn on how to store the Data in a Variable name using Visual Basic...","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:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/","og_locale":"en_US","og_type":"article","og_title":"VB.net Variables - Declaration and Initialization of Variables in VB","og_description":"Learn on How To Declare a VB.net Variable, In this tutorial you can learn on how to store the Data in a Variable name using Visual Basic...","og_url":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/","og_site_name":"Itsourcecode.com","article_published_time":"2022-06-21T05:50:14+00:00","article_modified_time":"2023-11-21T03:11:47+00:00","og_image":[{"width":1460,"height":900,"url":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Variables.png","type":"image\/png"}],"author":"angel jude suarez","twitter_card":"summary_large_image","twitter_misc":{"Written by":"angel jude suarez","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#article","isPartOf":{"@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/"},"author":{"name":"angel jude suarez","@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/dafb6a91b43e60537c56e3e1d227d460"},"headline":"VB.net Variables &#8211; Declaration and Initialization of Variables in VB","datePublished":"2022-06-21T05:50:14+00:00","dateModified":"2023-11-21T03:11:47+00:00","mainEntityOfPage":{"@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/"},"wordCount":838,"commentCount":0,"publisher":{"@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/ad9e0497e03b85a9ca299d935298f5dc"},"image":{"@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#primaryimage"},"thumbnailUrl":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Variables.png","keywords":["how to declare a variable in vb net","how to declare global variable in vb net","object variable or with block variable not set vb net","variable declaration in vb net","variable in vb net in hindi","variables in vb net","vb net environment variables","vb net public variable","vb net session variable","what is variable in vb net"],"articleSection":["VB.NET Tutorial"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/","url":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/","name":"VB.net Variables - Declaration and Initialization of Variables in VB","isPartOf":{"@id":"https:\/\/itsourcecode.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#primaryimage"},"image":{"@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#primaryimage"},"thumbnailUrl":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Variables.png","datePublished":"2022-06-21T05:50:14+00:00","dateModified":"2023-11-21T03:11:47+00:00","description":"Learn on How To Declare a VB.net Variable, In this tutorial you can learn on how to store the Data in a Variable name using Visual Basic...","breadcrumb":{"@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#primaryimage","url":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Variables.png","contentUrl":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2022\/06\/VB-NET-Variables.png","width":1460,"height":900,"caption":"VB NET Variables"},{"@type":"BreadcrumbList","@id":"https:\/\/itsourcecode.com\/tutorials\/visual-basic-tutorial\/vb-net-variables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/itsourcecode.com\/"},{"@type":"ListItem","position":2,"name":"VB.net Variables &#8211; Declaration and Initialization of Variables in VB"}]},{"@type":"WebSite","@id":"https:\/\/itsourcecode.com\/#website","url":"https:\/\/itsourcecode.com\/","name":"Itsourcecode.com","description":"Partner In Your Coding Journey!","publisher":{"@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/ad9e0497e03b85a9ca299d935298f5dc"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itsourcecode.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/ad9e0497e03b85a9ca299d935298f5dc","name":"itsourcecode","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2021\/01\/IT-SOURCECODE_ICON-07.jpg","url":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2021\/01\/IT-SOURCECODE_ICON-07.jpg","contentUrl":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2021\/01\/IT-SOURCECODE_ICON-07.jpg","width":409,"height":409,"caption":"itsourcecode"},"logo":{"@id":"https:\/\/itsourcecode.com\/wp-content\/uploads\/2021\/01\/IT-SOURCECODE_ICON-07.jpg"},"description":"Hello Itsourcecoders, welcome to itsourcecode.com. I'm Joken Villanueva, MIT a passionate Blogger, Programmer and a Hobbyist. I started Itsourcecode because I wanted to give back and Share all the learnings and knowledge I've learned in my career and I believe through this website I would be able to help and assist those newbie programmers in enhancing their skills from different programming languages. So let us all help each other by sharing our ideas!","sameAs":["https:\/\/itsourcecode.com\/"]},{"@type":"Person","@id":"https:\/\/itsourcecode.com\/#\/schema\/person\/dafb6a91b43e60537c56e3e1d227d460","name":"angel jude suarez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/itsourcecode.com\/wp-content\/litespeed\/avatar\/49f87b924bdd4e5fcbc3635ed3f7af29.jpg?ver=1776429718","url":"https:\/\/itsourcecode.com\/wp-content\/litespeed\/avatar\/49f87b924bdd4e5fcbc3635ed3f7af29.jpg?ver=1776429718","contentUrl":"https:\/\/itsourcecode.com\/wp-content\/litespeed\/avatar\/49f87b924bdd4e5fcbc3635ed3f7af29.jpg?ver=1776429718","caption":"angel jude suarez"},"description":"Hello programmers, I'm Angel Jude Reyes Suarez, a student and a programmer of different programming languages like Python, Java, JavaScript, PHP, C, C++, Vb.net, and MySQL. and I have also knowledge in developing system or websites from Front-End to Back-End. and also a writer of itsourcecode.com.","url":"https:\/\/itsourcecode.com\/author\/angeljudesuarez\/"}]}},"_links":{"self":[{"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/posts\/64005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/users\/1767"}],"replies":[{"embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/comments?post=64005"}],"version-history":[{"count":54,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/posts\/64005\/revisions"}],"predecessor-version":[{"id":120481,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/posts\/64005\/revisions\/120481"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/media\/64169"}],"wp:attachment":[{"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/media?parent=64005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/categories?post=64005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsourcecode.com\/wp-json\/wp\/v2\/tags?post=64005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}