Public Class Form1 Dim quest(9, 3), ans(9, 1) As String Dim i As Integer = -1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load quest(0, 0) = "Which language doesn't support .net ?" quest(0, 1) = "C" quest(0, 2) = "C++" quest(0, 3) = "C#" quest(1, 0) = "xml Stands for?" quest(1, 1) = "Extensive markup language" quest(1, 2) = "Extensible markup language" quest(1, 3) = "Extended markup language" quest(2, 0) = "IIS Stands for?" quest(2, 1) = "Internet Information Services" quest(2, 2) = "Intermediate Information Services" quest(2, 3) = "Internet Information Server" quest(3, 0) = "Which one is not a part of .net framework ?" quest(3, 1) = "Visual studio .Net" quest(3, 2) = "VB.Net" quest(3, 3) = "ASP.Net" quest(4, 0) = "Which one is heart of .Net framework?" quest(4, 1) = "CLR" quest(4, 2) = "CTS" quest(4, 3) = "CLS" quest(5, 0) = "Which of the following is the default name assigned to the label control in Visual Basic " quest(5, 1) = "Label1 " quest(5, 2) = "DefaultLabel " quest(5, 3) = "NewLabel " quest(6, 0) = " Which of the following is a basic data type in VB.NET?" quest(6, 1) = "Boolean " quest(6, 2) = "Byte" quest(6, 3) = "All the above" quest(7, 0) = "Which of the following is used to create a new object in VB.Net? " quest(7, 1) = "New() " quest(7, 2) = "Object.New()" quest(7, 3) = "Object() " quest(8, 0) = "Which of the following is used to handle errors in VB.Net? " quest(8, 1) = "Do...Loop " quest(8, 2) = "If...Then...Else" quest(8, 3) = "Try...Catch...Finally " quest(9, 0) = "Which of the following is used to read a binary file in VB.Net? " quest(9, 1) = "BinaryReader.Read() " quest(9, 2) = "ReadBinary() " quest(9, 3) = "System.IO.BinaryReader.Read()" ans(0, 0) = "c" ans(1, 0) = "Extensible markup language" ans(2, 0) = "internet information services" ans(3, 0) = "Vs.net" ans(4, 0) = "CLR" ans(5, 0) = "Label1" ans(6, 0) = "All the above" ans(7, 0) = "New()" ans(8, 0) = "Try...Catch...Finally" ans(9, 0) = "System.IO.BinaryReader.Read()" Timer1.Enabled = True End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick i = i + 1 If (i = 9) Then Timer1.Enabled = False Button1.Enabled = True RadioButton1.Enabled = False RadioButton2.Enabled = False RadioButton3.Enabled = False TextBox1.Clear() Else RadioButton1.Checked = False RadioButton2.Checked = False RadioButton3.Checked = False TextBox1.Text = quest(i, 0) RadioButton1.Text = quest(i, 1) RadioButton2.Text = quest(i, 2) RadioButton3.Text = quest(i, 3) End If End Sub Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged ans(i, 1) = RadioButton1.Text End Sub Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged ans(i, 1) = RadioButton2.Text End Sub Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged ans(i, 1) = RadioButton3.Text End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim j As Integer Dim count As Integer = 0 For j = 0 To 4 If (ans(j, 0) = ans(j, 1)) Then count = count + 1 End If Next MsgBox("you have scored".Count & " marks") End Sub 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