Notes
Notes
APPLICATIONS
Subject:Advance visual and windows programming(BCA-205)
PRESENTATION ON
VISUAL BASIC .NET
12/07/21 1
.NET Defined
Before getting deeply into the subject we will first know how
Businesses are related to Internet, what .NET means to them
and what exactly .NET is built upon. As per the product
documentation from a Business perspective, there are three
phases of the Internet. The First phase gets back to the early
1990's when Internet first came into general use and which
brought a big revolution for Businesses. In the First phase of
the Internet Businesses designed and launched their Website's
and focused on the number of hits to know how many
customers were visiting their site and interested in their
products, etc. The Second phase is what we are in right now
and in this phase Businesses are generating revenue through
Online Transactions. We are now moving into the Third phase
of the Internet where profit is the main priority. The focus
here is to Businesses effectively communicate with their
customers and partners who are geographically isolated,
participate in Digital Economy and deliver a wide range of
services. How can that be possible? The answer, with .NET.
Static: Makes a variable static which means that the variable will
hold the value even the procedure in which they are declared
ends
[accessibility] Function
functionname[(argumentlist)] As datatype
' Statements of the Function procedure.
End Function
End Sub
--------------------------------------------------------------------------------
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End Sub
ListBox1.Items.Add(ListBox2.Items.Item(ListBox2.SelectedIndex))
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
End Sub
End Sub
Example-Calculator
We can handle mouse events such as mouse pointer movements in Forms. The mouse
events supported by VB .NET are as follows:
MouseDown: This event happens when the mouse pointer is over the form/control and is
pressed
MouseEnter: This event happens when the mouse pointer enters the form/control
MouseUp: This event happens when the mouse pointer is over the form/control and the
mouse button is released
MouseLeave: This event happens when the mouse pointer leaves the form/control
MouseMove: This event happens when the mouse pointer is moved over the form/control
MouseWheel: This event happens when the mouse wheel moves while the form/control
has focus
MouseHover: This event happens when the mouse pointer hovers over the form/control
The properties of the MouseEventArgs objects that can be passed to the mouse event
handler are as follows:
Button: Specifies that the mouse button was pressed
Clicks: Specifies number of times the mouse button is pressed and released
X: The X-coordinate of the mouse click
Y: The Y-coordinate of the mouse click
Delta: Specifies a count of the number of detents (rotation of mouse wheel) the mouse
wheel has rotated
AllowFullOpen: Gets/Sets whether the user can use the dialog box to define
custom colors.
AnyColor: Gets/Sets whether the dialog box displays all the available colors in
the set of basic colons.
Color: Gets/Sets the color selected by the user.
CustomColors: Gets/Sets the set of custom colors shown in the dialog box.
FullOpen: Gets/Sets whether the controls used to create custom colors are
visible when the dialog box is opened.
ShowHelp: Gets/Sets whether the dialog box displays a help button.
SolidColorOnly: Gets/Sets whether the dialog box will restrict users to selecting
solid colors only.
The two primary methods for connections are Open and Close. The Open
method uses the information in the ConnectionString property to contact the
data source and establish an open connection. The Close method shuts the
connection down. Closing connections is essential, because most data sources
support only a limited number of open connections, and open connections take
up valuable system resources.
If you are working with data adapters or data commands, you do not have to
explicitly open and close a connection. When you call a method of these objects
(for example, the data adapter's Fill or Update method), the method checks
whether the connection is already open. If not, the adapter opens the
connection, performs its logic, and closes the connection again.
Methods such as Fill only open and close the connection automatically if it is not
already open. If the connection is open, the methods use it but do not close it.
This gives you the flexibility to open and close data commands yourself. You
might do this if you have multiple data adapters that share a connection. In that
case, it is inefficient to have each adapter open and close the connection when
you call its Fill method. Instead, you can open the connection, call the Fill
method of each adapter, and then close the connection when you are done.
Me.BindingContext(DataSet11, "studentmarks").AddNew()
Dim Changes As WindowsApplication12.DataSet1 = New
WindowsApplication12.DataSet1
Me.BindingContext(DataSet11, "studentmarks").EndCurrentEdit()
Changes =
CType(DataSet11.GetChanges,WindowsApplication12.DataSet1)
Me.OleDbConnection1.Open()
OleDbDataAdapter1.Update(DataSet11)
Me.OleDbConnection1.Close()
DataSet11.Merge(Changes)
DataSet11.AcceptChanges()
12/07/21 NAVGUJARAT COLLEGE OF COMPUTER 144
APPLICATIONS Kaushar Ghanchi
CODE TO DELETE RECORD
Me.BindingContext(DataSet11,
"studentmarks").RemoveAt(Me.BindingContext(DataSet11,
"studentmarks").Position)
Capacity
count
Isreadonly
Add
Addrange
Binarysearch
Clear
Copyto
Equals
Insert
Insertrange
Remove
Reverse
12/07/21 NAVGUJARAT COLLEGE OF COMPUTER 155
APPLICATIONS Kaushar Ghanchi
HASHTABLE COLLECTION
A Hashtable consists of buckets that contain
the elements of the collection. A bucket is a
virtual subgroup of elements within the
Hashtable, which makes searching and
retrieving easier and faster than in most
collections. Each bucket is associated with a
hash code, generated using a hash function
and based on the key of the element.
Properties
Maxvalue
Minvalue
Methods
Campareto
Isdigit
Isletter
Equals
12/07/21 NAVGUJARAT COLLEGE OF COMPUTER 162
APPLICATIONS Kaushar Ghanchi
String class
Represents a set of unicode characters
Properties
Chars
Length