VB.NET FAQ




What is a form in VB.NET?

Forms are the primary unit of the user interface.Design of the form should be consistent, complete, and attractive visual interface. You can add forms to your application at design time or at run time. Forms have properties that control their appearance



What is a context menu?

1.It is useful for enabling access to commands in a variety of contextual situations
2.It is created using ContextMenu control.
3.It is created at run time in the same manner as main menus



What is the use of Command builder?

Command builder generates insert/update/delete commands for data adapter based on select command. Automatic creation of insert/update/delete commands hinders performance. The command builder uses select command property of data adapter to determine values for other commands.
 


What is Shared member of the class?

It is member of the class which can be access without creating instance of the class. It belongs to the class and not to the instance of the class.
 


What is visual inheritance in VB.NET?

Visual inheritance allows deriving forms from the base form with common controls.
 


Define extender provider component?

It provides additional features to the controls. ErrorProvider, HelpProvider, and ToolTip components are the examples of extender provider.  
 


Explain how managed code slower than unmanaged code?

Managed code not always is slower than unmanaged code. In managed code, the CLR does some optimization for the way loops, subroutines should run and what is the best way to execute it.
 


What are the Types of globalization we use?

when you want to use your application should run in differnet language like you have developed the application for english and should also run in dutch, french, japanese etc., then through globalization you can set lacal and culture for the each language in seperate folder. So that when the application will run for a specific region it will be show the content in same language.
 


What is DataViewManager?

A Dataset may contain multiple tables. The DataViewManager is a single object that manages all the DataViews. It can be used to view settings for all the tables in a DataSet.You could use it to bind multiple tables in a control such as a parent-child relationship. The DataViewManager has a collection of DataViewSetting objects, each for a table in DataSet.Then you can even specify the default sort, filters etc in each of the DataViewSetting
 

What is the difference between dataset and datareader?

Dataset
1.DataSet object can contain multiple rowsets from the same data source as well as from the relationships between them
2.Dataset is a disconnected architecture
3.Dataset can persist data.
Datareader
1.DataReader provides forward-only and read-only access to data.
2.Datareader is connected architecture
3.Datareader can not persist data.
 


What is the difference between LINQ and Stored Procedures?

Stored procedures normally are faster as they have a predictable execution plan. Therefore, if a stored procedure is being executed for the second time, the database gets the cached execution plan to execute the stored procedure. LINQ supports type safety against stored procedures.
 


Define field-level validation and form-level validation?

Field-level validation means validating each field as it receives focus. Form-level validation is the process where you validate all data on a form before form is submitted.


 
Why do you use properties instead of fields?

You can provide validation code with properties that validate data being read or set. You can not add any validation code while using fields.
 


What is delegate?

A delegate acts like a strongly typed function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.
 


What is the use of parse method?

Parse method is used to convert string value to numeric type. All numeric data type have a Parse method.
 


What is trace?

Trace produces messages about program conditions even after application is compiled and released without interrupting application execution.
 


Describe exception handling in VB.NET?

The Try block encapsulate set of code that is error prone and can throw exception. If an exception is thrown, it can be caught in an appropriate Catch (catch) block. You have Finally block that can contain code that must be executed even if no exception is handled.
 


What is data provider? Explain its components?

Data Provider is a set of components that facilitate data access. It contains components like connection, command, dataReader, dataAdapter. Connection object connects to the data source. Command object represents a direct command to the data source. DataReader object that provides connected, forward-only, read-only access to a database. DataAdapter that provides disconnected data access.
 


Define DataReader and DataAdapter in ADO.NET?

DataReader: It is lightweight class that provides connected and forward-only data access. It uses connection object exclusively. You can read data; you can’t modify data using DataReader.
DataAdapter: This class provides disconnected data access. It opens a data connection just long enough to retrieve the data, and loads the data into a DataSet, thus provides in-memory copy of the data.
 


What is the use of ‘Preserve’ Keyword?

The preserve keyword helps to prevent data in an array from being lost.


 
What are the limitations of XML serialization?

XML serialization has some limitations. It converts public property values and fields, but does not encode type information. Also it does not encode private properties and fields, which requires binary serialization. Any class to be serialized to XML must have a public, parameterless constructor. One advantage of XML serialization is that the serialized data, being XML, rarely has any problems passing over networks and through security measures, such as firewalls, that might be unhappy with a binary data stream. For this reason, XML serialization is used by .Net Web services. Another advantage is that XML serialization is not platform-specific. In other words, you do not have to have .Net or Windows on both ends of the process.
 


What is the difference between string class and stringbuilder class?

string class in immutable. Immutable is nothing but the value assigned to string cannot be changed. Stringbuilder class is mutable. mutable is nothing but the value assigned to stringbuilder can be changed.
 


What is an Assembly?

An Assembly is the building block of a VB.NET application. An Assembly is a complied and versioned collection of code and metadata. Once complete forms an atomic functional unit.
 


How do you create a resource-only assembly?

One should create a resource only assembly if you need to update the resources frequently without recompiling the whole solution.
Steps to create it are:
a. Create a new empty project.
b. Add a new resource item to the project.
c. In project's property pages, choose output type as class library..
d. Build project to have the resource files being compiled in an assembly.
 


What are the options for stepping through code?

1.Show next statement
2.step into
3.step over
4.step out
 


What is the purpose of AddHandler keyword?

Addhandler associates an event with its handler at runtime.
 


What is the difference between System exceptions and Application exceptions?

SystemExceptions are thrown by the CLR and are of more generic nature, whereas, ApplicationExceptions are thrown by Applications. Therefore when creating a custom Exception class we should only inherit it from Application Exception and not SystemException.
 


What are Console Applications in VB.NET?

Console Applications have only recently been introduced in VB (Excluding VB for DOS). They are command line based and run in within a DOS Shell (DOS Window). Unlike Windows Applications, Console Applications do not support Windows GUI's. Which means that you can't work with controls from the toolbox.
 


What are Enumerations in VB.NET and how are they used?

Enumerations are new in VB.Net (As apposed to VB(i)) and they are used to group related sets of constants. To create a Enumeration you use the Enum statement.
 

How do I create Procedure Delegates?

Delegates are used to work with the address of procedures. This is much like pointers in C and C++. Sometimes it's useful to pass the location of a procedure to other procedures.


 
How to get the environment information in VB.NET?

The System.Environment namespace includes the functionality to get the environment information such as the UserName and OS Version.
 


How to convert the format of images in VB.NET?

To convert the format of an image you need to use the System.Drawing namespace. Using this code you can convert to a variety of graphic file formats, such as GIF or JPG.
 


Some of the documented properties are not available when I use the control in VB.NET. How can I access these properties?

Indexed properties, for example, the DeviceName property in TwainControlX, are not directly supported in VB.NET. These properties become hidden when the control is wrapped for use in the .NET environment. This problem is easily solved by prefixing the property name with either 'get_' or 'set_' depending whether the property is being read or written.
 


What is the concept of destructors in VB.NET?

Destructors are used to de-allocate resources i.e. to clean up after an object is no longer available.
 


How can I run a .EXE from a VB.NET application?

To run a .EXE file from a VB.NET application you need to import the System.Diagnostics namespace.
 


When I deploy a VB.NET application using the control, I get an error message "You do not have a license to use this ActiveX control". How do I solve this problem?

This error is usually caused by adding the control dynamically in code instead of placing an instance of the control on a form at design time. If the control instance must be created dynamically, the licence information must be added in the code.


 
How can I run another application or batch file from my Visual Basic .NET code?

you can use the classes and methods in System.Diagnostics.Process to accomplish these tasks and more.
 


How do I determine the difference between two dates?

In Visual Basic .NET there are two main ways to achieve this result, the DateDiff function or through the TimeSpan structure.
 

Can I run Visual Basic 6.0 and Visual Basic .NET on the same machine?

You can run them both on the same machine.
 

Explain how to retrieve information from the configuration file at run time?

To retrieve information from the configuration file.
Create an instance of AppSettingsReader to read the configuration file.
Call the GetValue method to read values represented in the configuration file.
To add configuration file entries
Create elements in the node of the configuration file.
Specify a value for the entry and a key in the element.
 


What is the difference between imperative and declarative security?

Imperative security is implemented by calling methods of Permission objects in code at run time. Declarative security is configured by attaching attributes representing permissions to classes and methods. Additionally, you can request assembly-wide permissions using the Assembly (assembly) directive with declarative security.  
 


What is a bootstrapper application? 

A bootstrapper application automatically detects if Windows Installer is installed on the target machine. If Windows Installer is not present, it installs Windows Installer before proceeding with the rest of the installation.


 
Describe Break mode?

Break mode allows reading code line-by-line. You can observe code in Break mode by using Step Into, Step Over, Step Out, Run To Cursor, and Set Next Statement.  
 


Describe an abstract class?

An abstract class is a class that cannot be instantiated but must be inherited. It can contain both implemented methods and abstract methods.
 


What are the Keyboard events in VB.NET?

Keyboard events allow you to validate keystrokes. They are raised by the control that has the focus and is receiving input. Following are the keyboard events.
1. KeyDown
2. KeyUp
3. KeyPress
 


What is the difference between reference type and value type?
A value type holds the data assigned to it. A reference type contains the pointer i.e. memory address that holds the data.
 


What are the similarities between a class and a structure in VB.NET?

Both the class and structure are user define types. 
Both are the template of the object. 
Both contain members like methods, properties, fields and use contractor for initialization. 
Both of them inherit from System.Object.



 What is the difference between VB6 and VB.NET?

The greatest change in VB6 and VB.NET is of runtime environment. VB6 used the VB-Runtime while VB.NET uses the .Net Common Language Runtime (.Net CLR). The CLR is much better designed and implemented than VB-Runtime. The CLR uses better code translation through Just in Time compiler while VB-Runtime interprets the code. The CLR Garbage Collector is also more efficient than VB6 one as it may detect cyclic references too.



What is Finalizer? Explain how to implement it?

It is a method that is executed when an object is garbage collected. It is similar in function to a destructor. It keeps the memory managed by taking appropriate an action against an object that is released or is no longer in use. It is called up internally on garbage collection.
 


What is implicit cast and explicit cast in .Net?

Implicit cast allows conversion without any loss of data and it takes place only when there is no possible of loss of data. When there is any possibility of loss of data, explicit cast is required. Remember, explicit cast if not applied properly can result a loss of data precision.



 
TekTipsDownload
GateExam
Academic Projects
TekTipsExperts
Android