.Net Full notes in one shot for bca

1.1 Automatic Resource Management

When it comes to .NET framework, the developers get efficient and automatic resource management systems like screen space, memory, network connections, and more. And this is all possible because of the common language runtime (CLR) of the .NET framework. In CLR, a garbage collector is an approach that serves as an automatic memory manager. The garbage collector here manages to allocate and release the memory for the .NET application. Every time a new object is created in the application, the common language runtime starts the process of allocating memory for the object from the managed heap. In this case, the runtime has the capability to handle object layout automatically and it also manages references to objects by releasing the references when they are not in use.

1.2 Cross-Language Interoperability

Language interoperability is one of the features of this cross-platform framework that comes with the ability that enables the code to interact with another code that is written by the .NET developers with the use of different programming languages. Basically, when it comes to creating applications for the clients’ businesses, developers prefer to give them .NET apps as these applications can be developed easily by maximizing the code reuse and improving the overall efficiency of the app development process. And all this is possible because of the cross-language features of the .NET framework. 

1.3 Common Type System

One of the features of the .NET framework is a common type system. It is an approach of .NET that ensures that the objects of the programs that are written in different .NET compliant programming languages have the capabilities to communicate with each other or not. Basically, a common type system (CTS) helps the developers to make a system that doesn’t lose data when a type in one language starts transferring data to a similar type in another language.

1.4 Easy and Rich Debugging Support

In .NET, the IDE (integrated development environment) has the capability to offer easy and rich debugging support. This means that when any exception occurs during the run time of an application, the program stops working, and the IDE marks the line of the code that contains a high error with the other errors that might have occurred and offered. In addition to this, the runtime of .NET technology also offers a built-in stack which can be much easier to find bugs.


A Detailed Guide to the Features of .NET Framework

Microsoft, a technology giant has given the app development market one of the best frameworks called .NET. The .NET framework has the capability to facilitate designing and developing applications that are robust, scalable, and portable. The applications created with the .NET framework can be executed in a distributed environment. This proves that .NET is a framework that presents a device-independent computing model to the developers in a managed environment for creating unique applications for their clients. Seeing .NET’s popularity and scalability, the majority of the businesses have started hiring .NET development services providers who can create a top-notch app for their company by taking complete advantage of the features of .NET.

To know more about .NET framework’s features that attract both business owners and developers towards it and see how any top .NET app development company uses them to create a robust application, let’s go through this blog.

1. Features of .NET Framework

Features of .NET Framework

Some of the major features of .NET Framework are –

1.1 Automatic Resource Management

When it comes to .NET framework, the developers get efficient and automatic resource management systems like screen space, memory, network connections, and more. And this is all possible because of the common language runtime (CLR) of the .NET framework. In CLR, a garbage collector is an approach that serves as an automatic memory manager. The garbage collector here manages to allocate and release the memory for the .NET application. Every time a new object is created in the application, the common language runtime starts the process of allocating memory for the object from the managed heap. In this case, the runtime has the capability to handle object layout automatically and it also manages references to objects by releasing the references when they are not in use.

Basically, automatic memory management is an approach that helps in resolving the two most common application errors, invalid memory references, and memory leaks.

1.2 Cross-Language Interoperability

Language interoperability is one of the features of this cross-platform framework that comes with the ability that enables the code to interact with another code that is written by the .NET developers with the use of different programming languages. Basically, when it comes to creating applications for the clients’ businesses, developers prefer to give them .NET apps as these applications can be developed easily by maximizing the code reuse and improving the overall efficiency of the app development process. And all this is possible because of the cross-language features of the .NET framework. 

1.3 Common Type System

One of the features of the .NET framework is a common type system. It is an approach of .NET that ensures that the objects of the programs that are written in different .NET compliant programming languages have the capabilities to communicate with each other or not. Basically, a common type system (CTS) helps the developers to make a system that doesn’t lose data when a type in one language starts transferring data to a similar type in another language.

This means that CTS has the capability to ensure that the data of an application is not lost when an integral variable of VB.NET is transferred to an integer variable of C#. The common type system defines a set of rules and types that are general for all the targeted languages at the CLR. It has the capability to support both reference types and value types. Here the value types are generated in the stack and they include all primitive structs, types, and enums. On the other hand, when it comes to reference types, they are developed in the managed heap and come with arrays, objects, and collections.

1.4 Easy and Rich Debugging Support

In .NET, the IDE (integrated development environment) has the capability to offer easy and rich debugging support. This means that when any exception occurs during the run time of an application, the program stops working, and the IDE marks the line of the code that contains a high error with the other errors that might have occurred and offered. In addition to this, the runtime of .NET technology also offers a built-in stack which can be much easier to find bugs.

1.5 Security

Another feature of .NET which makes all the developers choose this framework for creating their client’s application is security. The CLR in .NET has the capability to manage the system with the help of code and user identity coupled with a few permission checks. Here, in .NET, the identity of the source code can be known and permission for the resources can be changed as granted. This means that the security measures of the .NET framework are very strong. This framework also offers great support for role-based security with the use of Windows NT accounts and groups.

1.6 Tool Support

One of the best .NET framework features is its support for different types of tools. The CLR of .NET works hand-in-hand with all the tools that developers use for software development. Some of such tools are visual studio, debuggers, compilers, and profilers. These .NET tools have the capability to make the developer’s job much easier and simpler.

1.7 Portability

When it comes to app development in .NET, one of the best features that the developers get is .NET environment portability. This means that when the source code of the .NET application is written in a CLR-compliant language, it compiles and generates an intermediate and machine-independent code. This type of code portability was originally known as Microsoft Intermediate Language (MSIL). But later it was renamed Common Intermediate Language (CIL). The concept of CIL is the key to the portability of multiple languages in .NET.

1.8 Framework Class Library

One of the key features of .NET is its class library. The Base Class Library (BCL) in .NET is a type of library that is available for all .NET languages. This library has the capacity to offer classes that encapsulate many different but common functionalities like database interaction, reading and writing files, image design, XML and JSON manipulation, and more.

1.9 Elimination of DLL Hell

Another Visual Basic .NET framework feature is the elimination of DLL Hell. Generally, DLL Hell happens when various applications try to share a common DLL. This issue was resolved by the .NET framework by enabling the coexistence of multiple versions of the same DLL.

1.10 Simplified Development

With the .NET framework, web app development has become simpler as installing or uninstalling a window-based application can be carried out by copying or deleting files. And this is because the .NET components are not referenced in the Visual Studio code registry.

Conclusion

As seen in this blog, .NET is one of the best software development frameworks available in the market. This Microsoft product offers various .NET programming languages that enable the developers to create unique applications in its framework and run on the Windows platform. This feature-rich framework can be useful for creating different types of applications like web-based apps, web services, and forms-based apps. With the use of the .NET cross-platform framework, the developers can choose from a variety of programming languages before starting their app development process. This is the main reason behind this framework’s popularity.


VB.NET

VB.NET is known as Visual Basic.NET. VB.NET is a simple, object-oriented programming language developed by Microsoft in 2002, and it is the successor of Visual Basic 6 (VB6) language, that implement on the .NET Framework. One of the best features of the VB.NET language is that its program can also run on mono (multi-platform), which means that it is not restricted to run on the Windows operating system; moreover, it can also run on Linux and Mac OS. The Application built using the VB.NET is much secure, robust, high-performance, and easy to develop.

There is some VB.NET application:

  • Console Application
  • Mobile application
  • Windows forms Application
  • Window control library
  • .Net website

C#

C# is an open-source, general-purpose, object-oriented programming language that was developed by Microsoft in the year 2000, which runs on the .NET Framework. Furthermore, this language is also got certified as a standard programming language by the ECMA and ISO. The main purpose of using the C# programming language is that it is used to share information as well as services across all web services. It also enables the developer to develop a robust, secure, and portable application easily.

Some of the application are listed below:

  • Window and web-based application or services
  • Distributed application
  • Database application
  • VB.NET Operators

    In VB.NET programming, the Operator is a symbol that is used to perform various operations on variables. VB.NET has different types of Operators that help in performing logical and mathematical operations on data values. The Operator precedence is used to determine the execution order of different Operators in the VB.NET programming language

  • What is VB.NET Operator?

    In VB.NET, operator is a special symbol that tells the compiler to perform the specific logical or mathematical operation on the data values. The data value itself (which can be either a variable or a constant) is called an operand, and the Operator performs various operations on the operand.

    For example: In the expression,

  • Different Types of VB.NET Operators

    Following are the different types of Operators available in VB.NET:

    • Arithmetic Operators
    • Comparison Operators
    • Logical and Bitwise Operators
    • Bit Shift Operators
    • Assignment Operators
    • Concatenation Operators
    • Miscellaneous Operators

    .

VB.NET Control Statements

In VB.NET, the control statements are the statements that controls the execution of the program on the basis of the specified condition. It is useful for determining whether a condition is true or not. If the condition is true, a single or block of statement is executed. In the control statement, we will use if- Then, if Then Else, if Then ElseIf and the Select case statement.

We can define more than one condition to be evaluated by the program with statements. If the defined condition is true, the statement or block executes according to the condition, and if the condition is false, another statement is executed.

The following figure shows a common format of the decision control statements to validate and execute a statement:






VB.NET Do Loop

Loop is used to repeat the same process multiple times until it meets the specified condition in a program. By using a loop in a program, a programmer can repeat any number of statements up to the desired number of repetitions. A loop also provides the suitability to a programmer to repeat the statement in a program according to the requirement. A loop is also used to reduce the program complexity, easy to understand, and easy to debug.

Advantages of VB.NET loop

  • It provides code iteration functionality in a program.
  • It executes the statement until the specified condition is true.
  • It helps in reducing the size of the code.
  • It reduces compile time.

Types of Loops

There are five types of loops available in VB.NET:

  • Do While Loop
  • For Next Loop
  • For Each Loop
  • While End Loop
  • With End Loop

Do While Loop

In VB.NET, Do While loop is used to execute blocks of statements in the program, as long as the condition remains true. It is similar to the While End Loop, but there is slight difference between them. The while loop initially checks the defined condition, if the condition becomes true, the while loop's statement is executed. Whereas in the Do loop, is opposite of the while loop, it means that it executes the Do statements, and then it checks the condition.


What is a Variable?

A variable is a simple name used to store the value of a specific data type in computer memory. In VB.NET, each variable has a particular data type that determines the size, range, and fixed space in computer memory. With the help of variable, we can perform several operations and manipulate data values in any programming language.

VB.NET Variables Declaration

The declaration of a variable is simple that requires a variable name and data type followed by a Dim. A Dim is used in Class, Module, structure, Sub, procedure.

Syntax:

Dim [Variable_Name] As [Defined Data Type]



VB.NET Data Type

In VB.NET, data type is used to define the type of a variable or function in a program. Furthermore, the conversion of one data type to another type using the data conversion function.

Data Type refers to which type of data or value is assigning to a variable or function so that a variable can hold a defined data type value. For example, when we declare a variable, we have to tell the compiler what type of data or value is allocated to different kinds of variables to hold different amounts of space in computer memory.

Boolean A Boolean type depends on the implementing platform True or False
Char
Date
Decimal 16 byte
Double 8 byte
Integer 4byte
Long 
Object
Single
String

VB.NET Arrays

An array is a linear data structure that is a collection of data elements of the same type stored on a contiguous memory location. Each data item is called an element of the array. It is a fixed size of sequentially arranged elements in computer memory with the first element being at index 0 and the last element at index n - 1, where n represents the total number of elements in the array.


VB.NET Exception Handling

What is an Exception?

An exception is an unwanted error that occurs during the execution of a program and can be a system exception or application exception. Exceptions are nothing but some abnormal and typically an event or condition that arises during the execution, which may interrupt the normal flow of the program.

An exception can occur due to different reasons, including the following:

  • A user has entered incorrect data or performs a division operator, such as an attempt to divide by zero.
  • A connection has been lost in the middle of communication, or system memory has run out.

Exception Handling

When an error occurred during the execution of a program, the exception provides a way to transfer control from one part of the program to another using exception handling to handle the error. VB.NET exception has four built-in keywords such as Try, Catch, Finally, and Throw to handle and move controls from one part of the program to another.

Try 
A try block is used to monitor a particular exception that may throw an exception within the application. And to handle these exceptions, it always follows one or more catch blocks.

Catch  
It is a block of code that catches an exception with an exception handler at the place in a program where the problem arises.

Finally

It is used to execute a set of statements in a program, whether an exception has occurred.

Throw
 As the name suggests, a throw handler is used to throw an exception after the occurrence of a problem.

VB.NET Date & Time

In VB.NET, we use the Date and Time function to perform various operations related to date and time. Sometimes we need to display the date and time in our application or web application, such as when the last post edited, upgradation of new software version or patch-up details, etc.

In DateTime class, Date datatype stores date values, time values or date, and time values. Furthermore, to perform the date and time function, we need to import the System.DateTime class. The default value of DateTime is between 00:00:00 midnight, Jan 1, 0001 to 11:59:59 P.M., Dec 31, 9999 A.D.

Properties and method of DateTime

Date: It is used to return the date component of the DateTime Object.

Day: It is used to return the day of the month represented by the DateTime object.

DayOfWeek: It is used to return a particular day of the week represented by the DateTime object.

Minute: The Minute property is used to return the minute component by the DateTime object.

DateOfYear: It is used to return a day of the year represented by the DateTime object.

Hour: It is used to return the hour of the component of the date represented by the DateTime object.

Now: It is used to return the current date and time of the local system.

Month: The Month property is used to return the month name of the Datetime object.

Second: It is used to return the second of the DateTime object.

Ticks: It is used to return the number of ticks that refer to the DateTime object.

Today: It is used to return the current date of the system.

Year: It is used to return the year of the date represented by the DateTime object.

TimeOfDay: It is used to return the time of the day represented by the DateTime object.

Methods

The following are the most commonly used methods of the DateTime.

DaysInMonth: The DaysInMonth method is used to return the total number of days in the specified month of the year.

Add: It is used to return a new DateTime value by adding the timespan value to the DateTime object value.

AddHours: It is used to return a new time by adding the hours to the value of the Datetime object.

AddYears: It is used to return the year by adding the year to the value of the DateTime object.

AddDays: It is used to return the new Day by adding the days to the value of the DateTime object.

AddMinutes: It is used to display the new time by adding the minutes to the Datetime object.

AddMonths: It is used to return the new time by adding the months to the value of the Datetime object.

AddSeconds: It is used to return the new time by adding the seconds to the value of the Datetime object.

IsLeapYear: It uses a Boolean value that represents whether the particular year is a leap year or not.

VB.NET Form Controls

Form is used in VB.NET to create a form-based or window-based application. Using the form, we can build a attractive user interface. It is like a container for holding different control that allows the user to interact with an application. The controls are an object in a form such as buttons, Textboxes, Textarea, labels, etc. to perform some action. However, we can add any control to the runtime by creating an instance of it.

A Form uses a System.Windows.Form namespace, and it has a wide family of controls that add both forms and functions in a Window-based user interface.

VB.NET Form Properties

The following are the most important list of properties related to a form. And these properties can be set or read while the application is being executed.



BackColor

It is used to set the background color for the form.

BackgroundImage

It is used to set the background image of the form.

Cursor

It is used to set the cursor image when it hovers over the form.

AllowDrop

Using the AllowDrop control in a form, it allows whether to drag and drop on the form.

Font

It is used to get or set the font used in a form.

Locked

It determines whether the form is locked or not.

FormBorderStyle

It is used to set or get border style in a form.

Text

It is used to set the title for a form window.

MinimizeBox

MinimizeBox It is used to display the minimum option on the title bar of the form.

IsMDIChild

It is used to authenticate whether a form is a container of a Multiple Document Interface (MDI) child form.

Autoscroll

It allows whether to enable auto-scrolling in a form.

MaximizeBox

It is used to display the maximum option on the title bar of the form.

MaximumSize

It is used to set the maximum height and width of the form.

Language

It is used to specifies the localized language in a form.

AcceptButton

It is used to set the form button if the enter key is pressed.

Top, Left

It is used to set the top-left corner coordinates of the form in pixel.

Name

It is used to define the name of the form.

MinimumSize

It is used to set the minimum height and width of the form.

Enabled

It uses the True or False value to enable mouse or keyboard events in the form.

TopMost

It uses a Boolean value that represents whether you want to put the window form on top of the other form. By default, it is False.



Activated: An activated event is found when the user or program activates the form.

Click: A click event is active when the form is clicked.

Closed : A closed event is found before closing the form.

Closing: It exists when a form is closing.

DoubleClick

DoubleClick: The DoubleClick event is activated when a user double clicks on the form.

DragDrop: A DragDrop event is activated when a drag and drop operation is performed.

MouseDown: A MouseDown event is activated when the mouse pointer is on the form, and the mouse button is pressed.

GotFocus: A GotFocus event is activated when the form control receives a focus.

HelpButtonClicked: It is activated when a user clicked on the help button.

KeyDown: A KeyDown event is activated when a key is pressed while focussing on the form.

KeyUp: A KeyUp event is activated when a key is released while focusing on the form.

Load: The load event is used to load a form before it is first displayed.

LostFocus: It is activated when the form loses focus.

MouseEnter: A MouseEnter event is activated when the mouse pointer enters the form.

MouseHover: A MouseHover event is activated when the mouse pointer put on the form.

MouseLeave: A MouseLeave event is activated when the mouse pointer leaves the form surface.

Shown: It is activated whenever the form is displayed for the first time.

Scroll: A Scroll event is activated when a form is scrolled through a user or code.

Resize: A Resize event is activated when a form is resized.

Move: A Move event is activated when a form is moved.



MDI stands for Multiple Document Interface applications that allow users to work with multiple documents by opening more than one document at a time. Whereas, a Single Document Interface (SDI) application can manipulate only one document at a time.

The MDI applications act as the parent and child relationship in a form. A parent form is a container that contains child forms, while child forms can be multiple to display different modules in a parent form.

VB.NET has folowing rules for creating a form as an MDI form.

  1. MidParent: The MidParent property is used to set a parent form to a child form.
  2. ActiveMdiChild: The ActiveMdiChild property is used to get the reference of the current child form.
  3. IsMdiContainer: The IsMdiContainer property set a Boolean value to True that represents the creation of a form as an MDI form.
  4. LayoutMdi(): The LayoutMdi() method is used to arrange the child forms in the parent or main form.
  5. Controls: It is used to get the reference of control from the child form.

Let's create a program to display the multiple windows in the VB.NET Windows Forms.

Step 1: First, we have to open the Windows form and create the Menu bar with the use of MenuStrip control, as shown below.

VB.NET MDI Form

Step 2: After creating the Menu, add the Subitems into the Menu bar, as shown below.

VB.NET MDI Form

In the above image, we have defined two Subitems, First is the Feedback Form, and the Second is VB.NET.

Step 3: In the third step, we will create two Forms: The Child Form of the Main Form or Parent Form.




VB.NET Timer Control

The timer control is a looping control used to repeat any task in a given time interval. It is an important control used in Client-side and Server-side programming, also in Windows Services.

Furthermore, if we want to execute an application after a specific amount of time, we can use the Timer Control. Once the timer is enabled, it generates a tick event handler to perform any defined task in its time interval property. It starts when the start() method of timer control is called, and it repeats the defined task continuously until the timer stops.

Let's create a Timer control in the VB.NET Windows form by using the following steps.

Step 1: Drag and drop the Timer control onto the window form, as shown below.

VB.NET Timer Control

Step 2: Once the Timer is added to the form, we can set various properties of the Timer by clicking on the Timer control

Timer Control Properties

There are following properties of the VB.NET Timer control.


Properties


Name

The Name property is used to set the name of the control.

Enabled

The Enables property is used to enable or disable the timer control. By default, it is True.

Interval

An Interval property is used to set or obtain the iteration interval in milliseconds to raise the timer control's elapsed event. According to the interval, a timer repeats the task.

AutoReset

The AutoReset property is used to obtain or set a Boolean value that determines whether the timer raises the elapsed event only once.

Events

Events property are used to get the list of event handler that is associated with Event Component.

CanRaiseEvents

It is used to get a value that represents whether the component can raise an event.

Events of Timer Control

Events

Description

Disposed

When control or component is terminated by calling the Dispose method, a Dispose event occurs.

Elapsed

When the interval elapses in timer control, the Elapsed event has occurred.

Tick

A tick event is used to repeat the task according to the time set in the Interval property. It is the default event of a timer control that repeats the task between the Start() and Stop() methods.



Methods of Timer Control

Methods


BeginInt()

The BeginInt() method is used to start run time initialization of a timer control used on a form or by another component.

Dispose()

The Dispose() method is used to free all resources used by the Timer Control or component.

Dispose(Boolean)

It is used to release all resources used by the current Timer control.

Close()

The Close() method is used to release the resource used by the Timer Control.

Start()

The Start() method is used to begin the Timer control's elapsed event by setting the Enabled property to true.

EndInt()

The EndInt() method is used to end the run time initialization of timer control that is used on a form or by another component.

Stop()

The Stop() method is used to stop the timer control's elapsed event by setting Enabled property to false.

VB.NET Label Control

In VB.NET, a label control is used to display descriptive text for the form in control. It does not participate in user input or keyboard or mouse events. Also, we cannot rename labels at runtime. The labels are defined in the class System.Windows.Forms namespace.

Let's create a label in the VB.NET Windows by using the following steps:

Step 1: We have to drag the Label control from the Toolbox and drop it on the Windows form, as shown below.

VB.NET Classes and Object

Step 2: Once the Label is added to the form, we can set various properties to the Label by clicking on the Label control.


VB.NET Label Properties

Properties


AutoSize

As the name defines, an AutoSize property of label control is used to set or get a value if it is automatically resized to display all its contents.

Border Style

It is used to set the style of the border in the Windows form.

PreferredWidth

It is used to set or get the preferred width for the Label control.

Font

It is used to get or set the font of the text displayed on a Windows form.

PreferredHeight

It is used to set the height for the Label Control.

TextAlign

It is used to set the alignment of text such as centre, bottom, top, left, or right.

ForeColor

It is used to set the color of the text.

Text

It is used to set the name of a label in the Windows Form.

ContextMenu

It is used to get or sets the shortcut menu associated with the Label control.

DefaultSize

It is used to get the default size of the Label control.

Image

It is used to set the image to a label in Windows Form.

ImageIndex

It is used to set the index value to a label control displayed on the Windows form.



VB.NET Label Events

Events


AutoSizeChanged

An AutoSizeChanged event occurs in the Label control when the value of AutoSize property is changed.

Click

Click event is occurring in the Label Control to perform a click.

DoubleClick

When a user performs a double-clicked in the Label control, the DoubleClick event occurs.

GotFocus

It occurs when the Label Control receives focus on the Window Form.

Leave

The Leave event is found when the input focus leaves the Label Control.

TabIndexChanged

It occurs when the value of Tabindex property is changed in the Label control.

ControlRemoved

When the control is removed from the Control.ControlCollection, a ControlRemoved event, occurs.

TabStopChanged

It occurs when the property of TabStop is changed in the Label Control.

BackColorChanged

A BackColorChanged event occurs in the Label control when the value of the BackColor property is changed.

ControlAdded

When a new control is added to the Control.ControlCollection, a ControlAdded event occurs.

DragDrop

A DragDrop event occurs in the Label control when a drag and drop operation is completed.

Furthermore, we can also refer to the VB.NET Microsoft documentation to get a complete list of Label properties and events.

VB.NET Button Control

Button control is used to perform a click event in Windows Forms, and it can be clicked by a mouse or by pressing Enter keys. It is used to submit all queries of the form by clicking the submit button or transfer control to the next form. However, we can set the buttons on the form by using drag and drop operation.


Step 1: We have to drag the Button control from the Toolbox and drop it on the Windows form, as shown below.

VB.NET Button Control

Step 2: Once the button is added to the form, we can set various properties of the Button by clicking on the Button control.

VB.NET Button Properties

AutoSizeMode
It is used to get or set the auto mode value through which the button can automatically resize in the Windows form.
BackColor
It is used to set the background color of the Button in the Windows form.
BackgroundImage
It is used to set the background image of the button control.
ForeColor
It is used to set or get the foreground color of the button control.
Image
It is used to set or gets the image on the button control that is displayed.
Location
It is used to set the upper-left of the button control's coordinates relative to the upper-left corner in the windows form.
Text
It is used to set the name of the button control in the windows form.
AllowDrop
It is used to set or get a value representing whether the button control can accept data that can be dragged by the user on the form.
TabIndex
It is used to set or get the tab order of the button control within the form.
VB.NET Button Events
BackColorChanged
A BackColorChaged event is found in button control when the Background property is changed.
BackgroundImageChanged
A BackgoundImageChanged event is found in button control when the value of the BackgoundImage property is changed.
Click
A Click event is found in the button control when the control is clicked.
ContextManuChanged
It is found in button control when the value of the ContextMenu property is changed.
ControlAdded
A ControlAdded event is found in button control when a new control is added to the Control.ControlCollection.
CursorChanged
A CursorChanged event is found in button control when the value of the control is changed.
DoubleClick
When the user makes a double click on the button, a double click event is found in the button control.
TextChanged
It is found in the button control when the value of the text property is changed.
DragDrop
The DragDrop event is found in the button control when the drag and drop operation is completed in the Form.
Furthermore, we can also refer to the VB.NET Microsoft documentation to get a complete list of Button properties and events.

VB.NET TextBox Control

A TextBox control is used to display, accept the text from the user as an input, or a single line of text on a VB.NET Windows form at runtime. Furthermore, we can add multiple text and scroll bars in textbox control. However, we can set the text on the textbox that displays on the form.

Let's create a TextBox control in the VB.NET Windows form by using the following steps:

Step 1: We have to drag the TextBox control from the Toolbox and drop it on the Windows form, as shown below.

VB.NET TextBox Control

Step 2: Once the TextBox is added to the form, we can set various properties of the TextBox by clicking on the TextBox control.

VB.NET TextBox Properties

There are following properties of the TextBox control.

VB.NET TextBox Control


Properties

AutoCompleteMode
It is used to get or set a value that indicates how the automatic completion works for the textbox control.
Font
It is used to set the font style of the text displayed on a Windows form.
Lines
It is used to set the number of lines in a TextBox control.
CharacterCasing
It is used to get or set a value representing whether the TextBox control can modify the character's case as they typed.
Multiline
It is used to enter more than one line in a TextBox control, by changing the Multiline property value from False to True.
AcceptsReturn
It is used to get or set a value that indicates whether pressing the enter button in a multiline textbox; it creates a new line of text in control.
PasswordChar
It is used to set the password character that can be a mask in a single line of a TextBox control.
PreferredHeight
It is used to set the preferred height of the textbox control in the window form.
ScrollBars
It is used to display a scrollbar on a multiline textbox by setting a value for a Textbox control.
Text
It is used to get or set the text associated with the textbox control.
Visible
The Visible property sets a value that indicates whether the textbox should be displayed on a Windows Form.
WordWrap
The WordWrap properties validate whether the multiline Textbox control automatically wraps words to the beginning of the next line when necessary.


VB.NET TextBox Events


Click
When a textbox is clicked, a click event is called in the textbox control.
CausesValidationChanged
It occurs in the TextBox Control when the value of CauseValidation property is changed.
AcceptTabsChanged
It is found in the TextBox control when the property value of the AcceptTab is changed.
BackColorChanged
It is found in the TextBox Control when the property value of the BackColor is changed.
BorderStyleChanged
It is found in the TextBox Control when the value of the BorderStyle is changed.
ControlAdded
It is found when the new control is added to the Control.ControlCollection.
CursorChanged
It is found in TextBox, when the textbox control is removed from the Control.ControlCollection.
FontChanged
It occurs when the property of the Font is changed.
GetFocus
It is found in TextBox control to get the focus.
MouseClick
A MouseClick event occurs when the mouse clicks the control.
MultilineChanged
It is found in a textbox control when the value of multiline changes.


VB.NET ComboBox Control

The ComboBox control is used to display more than one item in a drop-down list. It is a combination of Listbox and Textbox in which the user can input only one item. Furthermore, it also allows a user to select an item from a drop-down list.

Let's create a ComboBox control in the VB.NET Windows by using the following steps.

Step 1: We need to drag the combo box control from the toolbox and drop it to the Windows form, as shown below.

VB.NET ComboBox Control

Step 2: Once the ComboBox is added to the form, we can set various properties of the ComboBox by clicking on the ComboBox control.

ComboBox Properties

There are following properties of the ComboBox control.

VB.NET ComboBox Control


Property

AllowSelection
The AllowSelection property takes the value that indicates whether the list allows selecting the list item.
AutoCompleteMode
It takes a value that represents how automatic completion work for the ComboBox.
Created
It takes a value that determines whether the control is created or not.
DataBinding
It is used to bind the data with a ComboBox Control.
BackColor
The BackColor property is used to set the background color of the combo box control.
DataSource
It is used to get or set the data source for a ComboBox Control.
FlatStyle
It is used to set the style or appearance for the ComboBox Control.
MaxDropDownItems
The MaxDropDownItems property is used in the combo box control to display the maximum number of items by setting a value.
MaxLength
It is used by the user to enter maximum characters in the editable area of the combo box.
SelectedItem
It is used to set or get the selected item in the ComboBox Control.
Sorted
The Sorted property is used to sort all the items in the ComboBox by setting the value.


ComboBox Events
Events

FontChanged
It occurs when the property of the font value is changed.
Format
When the data is bound with a combo box control, a format event is called.
SelectIndexChanged
It occurs when the property value of SelectIndexChanged is changed.
HelpRequested
When the user requests for help in control, the HelpRequested event is called.
Leave
It occurs when the user leaves the focus on the ComboBox Control.
MarginChanged
It occurs when the property of margin is changed in the ComboBox control.

VB.NET CheckedListBox Control

The CheckedListBox is similar to Listbox except that it displays all items in the list with a checkbox that allows users to check or uncheck single or multiple items.

Let's create a CheckedListBox control in the VB.NET Windows form using the following steps.

Step 1: Drag the CheckedListBox control from the Toolbox and drop it to the Windows form, as shown below.

VB.NET CheckedListBox Control

Step 2: Once the CheckedListBox is added to the Form, we can set various properties of the CheckedListbox by clicking on the CheckedListBox control.


CheckedListBox Properties

There are following properties of the CheckedListBox control.


AccessibilityObject
It obtains a value that determines whether the AccessibilityObject is assigned to the CheckedListBox control.
AccessibleName
It gets or sets a value that tells if the accessible client application has used the name of the checkedlistbox control.
AllowSelection
It gets a value that indicates whether the ListBox allows for the item to be selected from the list.
AllowScollOffset
It gets or sets a value representing whether the CheckedListBox control is scrolled in ScrollControlIntoView(Control).
BorderStyle
It is used to set the type of border around the CheckedListBox by getting or setting a value.
CheckedItems
It is used to store a collection of checked items in the CheckedListBox.
ScrollAlwaysVisible
It is used to set or get a value that indicates if the vertical scroll bar appears in Windows Forms at all times.
SelectedItems
It is used to get all selected items from CheckedListBox.
SelectionMode
It is used to get or set a value representing the items' selection mode in the CheckedListBox.
TopIndex
It is used to set the first visible item at the top of the index in the CheckedListBox.






RadioButton Control

The RadioButton is used to select one option from the number of choices. If we want to select only one item from a related or group of items in the windows forms, we can use the radio button. The RadioButton is mutually exclusive that represents only one item is active and the remains unchecked in the form.

Let's create a RadioButton control in the VB.NET Windows by using the following steps.

Step 1: Drag the RadioButton control from the toolbox and drop it to the Windows form, as shown below.

RadioButton Control

Step 2: Once the RadioButton is added to the form, we can set various properties of the RadioButton by clicking on the Radio control.


RadioButton Properties
There are following properties of the VB.NET RadioButton control.

AllowDrop
It is used to set or get a value representing whether the RadioButton allows the user to drag on the form.
Appearance
It is used to get or set a value that represents the appearance of the RadioButton.
AutoScrollOffset
It is used to get or set the radio control in ScrollControlIntoView(Control).
AutoCheck
The AutoCheck property is used to check whether the checked value or appearance of control can be automatically changed when the user clicked on the RadioButton control.
AutoSize
The AutoSize property is used to check whether the radio control can be automatically resized by setting a value in the RadioButton control.
CanSelect
A CanSelect property is used to validate whether a radio control can be selected by setting a value in the RadioButton control.
CheckAlign
It is used to obtain or set a value that indicates the location of the check portion in the radioButton control.
Text
The Text property is used to set the name of the RadioButton control.

VB.NET ScrollBars Control

A ScrollBar control is used to create and display vertical and horizontal scroll bars on the Windows form. It is used when we have large information in a form, and we are unable to see all the data. Therefore, we used VB.NET ScrollBar control. Generally, ScrollBar is of two types: HScrollBar for displaying scroll bars and VScrollBar for displaying Vertical Scroll bars.

Let's create a ScrollBar control in the VB.NET Windows form using the following steps.

Step 1: The first step is to drag the HScrollBar and VScrollBar control from the toolbox and drop it on to the form.

VB.NET ScrollBars Control

Step 2: Once the ScrollBar is added to the form, we can set various properties of the ScrollBar by clicking on the HScrollBar and VScrollBar control.

Properties of the ScrollBar Control
There are following properties of the VB.NET ScrollBar control.

Property
Description
BackColor
The BackColor property is used to set the back color of the scroll bar.
Maximum
It is used to set or get the maximum value of the Scroll Bar control. By default, it is 100.
Minimum
It is used to get or set the minimum value of the Scroll bar control. By default, it is 0.
SmallChange
It is used to obtain or set a value that will be added or subtracted from the property of the scroll bar control when the scroll bar is moved a short distance.
AutoSize
As the name suggests, the AutoSize property is used to get or set a value representing whether the scroll bar can be resized automatically or not with its contents.
LargeChange
It is used to obtain or set a value that will be added or subtracted from the property of the scroll bar control when the scroll bar is moved a large distance.
Value
It is used to obtain or set a value in a scroll bar control that indicates a scroll box's current position.
DefaultImeMode
It is used to get the default input method Editor (IME) that are supported by ScrollBar controls in the Windows Form.

ADO.NET DataAdapter

The DataAdapter works as a bridge between a DataSet and a data source to retrieve data. DataAdapter is a class that represents a set of SQL commands and a database connection. It can be used to fill the DataSet and update the data source.


ADO.NET DataSet

It is a collection of data tables that contain the data. It is used to fetch data without interacting with a Data Source that's why, it also known as disconnected data access method. It is an in-memory data store that can hold more than one table at the same time. We can use DataRelation object to relate these tables. The DataSet can also be used to read and write data as XML document.

ADO.NET provides a DataSet class that can be used to create DataSet object. It contains constructors and methods to perform data related operations.


What is a relational database?

A relational database is a collection of information that organizes data in predefined relationships where data is stored in one or more tables (or "relations") of columns and rows, making it easy to see and understand how different data structures relate to each other. Relationships are a logical connection between different tables, established on the basis of interaction among these tables.

Learn how Google Cloud’s relational databases Cloud SQL, Cloud Spanner and AlloyDB for PostgreSQL can help you reduce operational costs and help you build transformative applications.

Simple Data Binding

Simple data binding involves the read-only selection lists. These controls can bind to an array list or fields from a database. Selection lists takes two values from the database or the data source; one value is displayed by the list and the other is considered as the value corresponding to the display.

Let us take up a small example to understand the concept. Create a web site with a bulleted list and a SqlDataSource control on it. Configure the data source control to retrieve two values from your database .

Declarative Data Binding

We have already used declarative data binding in the previous tutorial using GridView control. The other composite data bound controls capable of displaying and manipulating data in a tabular manner are the DetailsView, FormView, and RecordList control.










Comments

Popular posts from this blog

Java Quick revision

Quick revision for software engineering by vikatu

Quick Revision for folk and community media by vikatu.