<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.txtnumber1 = New System.Windows.Forms.TextBox() Me.txtnumber2 = New System.Windows.Forms.TextBox() Me.Label1 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label() Me.btnadd = New System.Windows.Forms.Button() Me.btnsub = New System.Windows.Forms.Button() Me.btndiv = New System.Windows.Forms.Button() Me.btnmulti = New System.Windows.Forms.Button() Me.Label3 = New System.Windows.Forms.Label() Me.Button1 = New System.Windows.Forms.Button() Me.Label4 = New System.Windows.Forms.Label() Me.CheckBox1 = New System.Windows.Forms.CheckBox() Me.RadioButton1 = New System.Windows.Forms.RadioButton() Me.ListBox1 = New System.Windows.Forms.ListBox() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.Button2 = New System.Windows.Forms.Button() Me.PictureBox2 = New System.Windows.Forms.PictureBox() Me.lblanswer = New System.Windows.Forms.Label() CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'txtnumber1 ' Me.txtnumber1.Location = New System.Drawing.Point(94, 16) Me.txtnumber1.Name = "txtnumber1" Me.txtnumber1.Size = New System.Drawing.Size(107, 20) Me.txtnumber1.TabIndex = 0 ' 'txtnumber2 ' Me.txtnumber2.Location = New System.Drawing.Point(94, 59) Me.txtnumber2.Name = "txtnumber2" Me.txtnumber2.Size = New System.Drawing.Size(107, 20) Me.txtnumber2.TabIndex = 1 ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(22, 23) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(56, 13) Me.Label1.TabIndex = 2 Me.Label1.Text = "Number 1:" ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.Location = New System.Drawing.Point(22, 66) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(56, 13) Me.Label2.TabIndex = 3 Me.Label2.Text = "Number 2:" ' 'btnadd ' Me.btnadd.Location = New System.Drawing.Point(78, 143) Me.btnadd.Name = "btnadd" Me.btnadd.Size = New System.Drawing.Size(75, 23) Me.btnadd.TabIndex = 4 Me.btnadd.Text = "Add" Me.btnadd.UseVisualStyleBackColor = True ' 'btnsub ' Me.btnsub.Location = New System.Drawing.Point(78, 195) Me.btnsub.Name = "btnsub" Me.btnsub.Size = New System.Drawing.Size(75, 23) Me.btnsub.TabIndex = 5 Me.btnsub.Text = "Subtract" Me.btnsub.UseVisualStyleBackColor = True ' 'btndiv ' Me.btndiv.Location = New System.Drawing.Point(78, 248) Me.btndiv.Name = "btndiv" Me.btndiv.Size = New System.Drawing.Size(75, 23) Me.btndiv.TabIndex = 6 Me.btndiv.Text = "Divide" Me.btndiv.UseVisualStyleBackColor = True ' 'btnmulti ' Me.btnmulti.Location = New System.Drawing.Point(78, 294) Me.btnmulti.Name = "btnmulti" Me.btnmulti.Size = New System.Drawing.Size(75, 23) Me.btnmulti.TabIndex = 7 Me.btnmulti.Text = "Multiply" Me.btnmulti.UseVisualStyleBackColor = True ' 'Label3 ' Me.Label3.AutoSize = True Me.Label3.Location = New System.Drawing.Point(22, 105) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(45, 13) Me.Label3.TabIndex = 8 Me.Label3.Text = "Answer:" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(276, 56) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(75, 23) Me.Button1.TabIndex = 10 Me.Button1.Text = "Button1" Me.Button1.UseVisualStyleBackColor = True ' 'Label4 ' Me.Label4.AutoSize = True Me.Label4.Location = New System.Drawing.Point(377, 108) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(39, 13) Me.Label4.TabIndex = 11 Me.Label4.Text = "Label4" ' 'CheckBox1 ' Me.CheckBox1.AutoSize = True Me.CheckBox1.Location = New System.Drawing.Point(380, 254) Me.CheckBox1.Name = "CheckBox1" Me.CheckBox1.Size = New System.Drawing.Size(81, 17) Me.CheckBox1.TabIndex = 12 Me.CheckBox1.Text = "CheckBox1" Me.CheckBox1.UseVisualStyleBackColor = True ' 'RadioButton1 ' Me.RadioButton1.AutoSize = True Me.RadioButton1.Location = New System.Drawing.Point(380, 289) Me.RadioButton1.Name = "RadioButton1" Me.RadioButton1.Size = New System.Drawing.Size(90, 17) Me.RadioButton1.TabIndex = 13 Me.RadioButton1.TabStop = True Me.RadioButton1.Text = "RadioButton1" Me.RadioButton1.UseVisualStyleBackColor = True ' 'ListBox1 ' Me.ListBox1.FormattingEnabled = True Me.ListBox1.Location = New System.Drawing.Point(380, 340) Me.ListBox1.Name = "ListBox1" Me.ListBox1.Size = New System.Drawing.Size(191, 43) Me.ListBox1.TabIndex = 15 ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(350, 146) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(111, 20) Me.TextBox1.TabIndex = 16 ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(276, 98) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(75, 23) Me.Button2.TabIndex = 10 Me.Button2.Text = "Button1" Me.Button2.UseVisualStyleBackColor = True ' 'PictureBox2 ' Me.PictureBox2.Image = Global.tester.My.Resources.Resources.Dog Me.PictureBox2.Location = New System.Drawing.Point(380, 56) Me.PictureBox2.Name = "PictureBox2" Me.PictureBox2.Size = New System.Drawing.Size(32, 32) Me.PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize Me.PictureBox2.TabIndex = 14 Me.PictureBox2.TabStop = False Me.PictureBox2.Visible = False ' 'lblanswer ' Me.lblanswer.AutoSize = True Me.lblanswer.Location = New System.Drawing.Point(94, 105) Me.lblanswer.Name = "lblanswer" Me.lblanswer.Size = New System.Drawing.Size(0, 13) Me.lblanswer.TabIndex = 17 ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(228, 395) Me.Controls.Add(Me.lblanswer) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.ListBox1) Me.Controls.Add(Me.PictureBox2) Me.Controls.Add(Me.RadioButton1) Me.Controls.Add(Me.CheckBox1) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.btnmulti) Me.Controls.Add(Me.btndiv) Me.Controls.Add(Me.btnsub) Me.Controls.Add(Me.btnadd) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.txtnumber2) Me.Controls.Add(Me.txtnumber1) Me.Name = "Form1" Me.Text = "Form1" CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents txtnumber1 As TextBox Friend WithEvents txtnumber2 As TextBox Friend WithEvents Label1 As Label Friend WithEvents Label2 As Label Friend WithEvents btnadd As Button Friend WithEvents btnsub As Button Friend WithEvents btndiv As Button Friend WithEvents btnmulti As Button Friend WithEvents Label3 As Label Friend WithEvents Button1 As Button Friend WithEvents Label4 As Label Friend WithEvents CheckBox1 As CheckBox Friend WithEvents RadioButton1 As RadioButton Friend WithEvents ListBox1 As ListBox Friend WithEvents TextBox1 As TextBox Friend WithEvents Button2 As Button Friend WithEvents PictureBox2 As PictureBox Friend WithEvents lblanswer As Label End Class
Write, Run & Share VB.net code online using OneCompiler's VB.net online compiler for free. It's one of the robust, feature-rich online compilers for VB.net language, running on the latest version 16. Getting started with the OneCompiler's VB.net compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as VB.net
. OneCompiler also has reference programs, where you can look for the sample code to get started with.
OneCompiler's VB.net online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample VB.net program which takes name as input and prints hello message with your name.
Public Module Program
Public Sub Main(args() As string)
Dim name as String = Console.ReadLine() ' Reading input from STDIN
Console.WriteLine("Hello " & name) ' Writing output to STDOUT
End Sub
End Module
Visual Basic is a event driven programming language by Microsoft, first released in the year 1991.
Variable is a name given to the storage area in order to identify them in our programs.
Simple syntax of Variable declaration is as follows
Dim variableName [ As [ New ] dataType ] [ = initializer ]
variableName = value
If condition-expression Then
'code
End If
If(conditional-expression)Then
'code if the conditional-expression is true
Else
'code if the conditional-expression is false
End If
If(conditional-expression)Then
'code if the above conditional-expression is true
Else If(conditional-expression) Then
'code if the above conditional-expression is true
Else
'code if the above conditional-expression is false
End If
If(conditional-expression)Then
'code if the above conditional-expression is true
If(conditional-expression)Then
'code if the above conditional-expression is true
End If
End If
Select [ Case ] expression
[ Case expressionlist
'code ]
[ Case Else
'code ]
End Select
For counter [ As datatype ] = begin To end [ Step step ]
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ counter ]
For Each element [ As datatype ] In group
'code
[ Continue For ]
'code
[ Exit For ]
'code
Next [ element ]
While conditional-expression
'Code
[ Continue While ]
'Code
[ Exit While ]
'Code
End While
Do { While | Until } conditional-expression
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Loop
Do
'Code
[ Continue Do ]
'Code
[ Exit Do ]
'Code
Loop { While | Until } conditional-expression
Procedure is a sub-routine which contains set of statements. Usually Procedures are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
Procedures are of two types.
Functions return a value when they are called.
[accessModifiers] Function functionName [(parameterList)] As returnType
'code
End Function
Sub-procedures are similar to functions but they don't return any value.
Sub ProcedureName (parameterList)
'Code
End Sub