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 developed with the primary objective of facilitating a smooth transition for Visual Basic 6 developers into the .NET ecosystem, aiming to streamline the migration process. While examining the core functionality, it becomes apparent that there are relatively few disparities between VB.NET and C#. Both languages ultimately compile into the Common Intermediate Language (CIL), which, in turn, is transformed into machine code. Furthermore, both VB.NET and C# use the same runtime engine, encompassing essential components such as memory management, thereby sharing common libraries and promoting interoperability within the .NET framework.

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


What is the use of New Keyword?

The "New" keyword serves several essential purposes, allowing developers to create new object instances, establish a constructor constraint on a type parameter, and designate a Sub procedure as a class constructor. In both declaration and assignment statements, the "New" clause can be employed. When the statement is executed, it invokes the relevant constructor of the specified class, and any supplied arguments are appropriately passed to initialize the object instance. This feature enhances code flexibility and enables efficient object instantiation and initialization within the context of VB.NET development.

What is TRACE in VB.Net?

Tracing plays a vital role in assisting developers during application debugging and bug-fixing processes. By employing trace mechanisms, developers can generate messages pertaining to various program conditions, even after the application has been compiled and released. This process occurs seamlessly without causing any interruptions to the application's execution. Tracing proves to be a valuable tool in identifying and resolving issues, as it provides valuable insights into the application's behavior during runtime, enabling developers to pinpoint specific areas that require attention and improvement.

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?

The "Ansi" keyword serves a critical role in Visual Basic by instructing the language to marshal all strings to American National Standards Institute (ANSI) values, regardless of the external procedure's name declared in the code. By utilizing the "Ansi" keyword, developers can ensure consistent handling and encoding of strings, adhering to the ANSI standards, which are widely recognized and utilized for character representation and data interchange. This feature promotes interoperability and compatibility with various systems and external libraries, further enhancing the robustness and reliability of the application's string manipulation and communication capabilities.

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

0 (Zero)

What is Redim variable in VB.NET used for?

The "ReDim" keyword in Visual Basic serves as a crucial tool for dynamically resizing arrays. By specifying the desired maximum number of elements, developers can employ the "ReDim" keyword to create a new array of the specified size. This feature empowers developers to efficiently manage and adapt the array's size during runtime, enhancing the application's flexibility and memory utilization. Consequently, it enables more efficient memory allocation and deallocation, promoting optimized performance and adaptability in handling arrays of varying sizes and data requirements.

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".