VB.Net Interview Questions (Part-1)

What is entry point method of VB.NET program?

Public Sub Main() indicates the entry point of VB.Net program.

What is the difference between C# and VB.Net?

VB.NET was created in order to make Visual Basic 6 developers transition to .NET easier. Under the covers, not much differences. Both C# and VB.NET are compiled into the same Common Intermediate Language, which is then complied into machine code. They share the same runtime engine (for memory management etc.) and libraries.

Check here for a Complete Comparison for VB.NET and C#


What is the use of New Keyword?

New Keyword is to create a new object instance, specifies a constructor constraint on a type parameter, or identifies a Sub procedure as a class constructor . You can use a New clause in a declaration statement or an assignment statement. When the statement runs, it calls the appropriate constructor of the specified class, passing any arguments you have supplied.

What is TRACE in VB.Net?

The tracing is the help in your application for debugging and bug fixing . Trace produces messages about program conditions even after application is compiled and released without interrupting application execution.

What is the default value for Boolean variable in VB.NET?

The default boolean value is False in VB.Net

How many .NET languages can a single .NET DLL contain?

Only one language is there in a .Net DLL

How to create a constant in VB.NET?

You use the Const statement to declare a constant and set its value.

Public Const DaysInYear = 365 Private Const WorkDays = 250

What is the purpose of Ansi keyword in VB.NET?

Ansi keyword specifies that Visual Basic should marshal all strings to American National Standards Institute (ANSI) values regardless of the name of the external procedure being declared.

What is the lower bound value of array in VB.NET?

0 (Zero)

What is Redim variable in VB.NET used for?

ReDim keyword resizes an array. We specify the maximum number of elements we want the array to have. ReDim then creates a new array of that size.

In how many ways a function can return value in VB.NET?

In VB.Net, a function can return a value to the calling code in two ways -

  1. By using the return statement.
  2. By assigning the value to the function name.

Can you create a function in VB.NET which can accept varying number of arguments?

By using the params keyword, a method parameter can be specified which takes a variable number of arguments or even no argument.

How do you limit implicit type conversion in VB.NET?

Option Strict On

How does VB.NET instantiates the .NET object?

Using NEW keyword

How you refer the parent class in VB.Net?


Is it possible Vb.Net classes derived in C# ?

Since VB.Net Adheres to Common Type System it is possible to derive a class written in VB.Net in C#.

How do you trigger an event in VB.NET?

You should send a button as sender into the event handler:

btnStart_Click(btnStart, New EventArgs())

How to return multiple values from a function in vb.net?

  1. By Reference argument (ByRef )
  2. Collection
  3. Dictionary object

Difference between VB mdi form and .Net mdi form?

In VB MDI form is created by adding MDI Form to the project and adding child forms by setting MDICHILD property of the child form.

In .NET there is no MDI form, any form can be made a MDI parent by setting IsMdiContainer property to TRUE.

What is the keyword in VB equivalent to "static" keyword in C#?

The equivalent of the C# Static method modifier in VB.net is "Shared".