VB .NET Unit-2
VB .NET Unit-2
NET
FRONT END DESIGN TOOL
USING
VB .NET
UNIT - 2
PRESENTATION BY:
ANKIT VERMA
(IT DEPARTMENT)
Properties Window
Lists properties associated with control.
Solution Explorer
Display solution name, project name, form name, fields etc.
Tool Box
Provide controls like form, data, components, toolbar, menu etc.
Object Browser
Shows the members of object
Server Explorer
Database connectivity, display tables, views, connections etc.
Dynamic Help
Context sensitive help.
Class View
Display Classes , methods, properties etc.
Provide
Project Name
Window Application
Create application with window interface.
Class Library
Create classes to use in other application.
Console Application
Create command line application.
Empty Project
Creating local application.
Window Service
Create window service.
Design Time
Environment where application being developed.
Run Time
Execution of application.
Forms
Basic element for creating user interface for application.
Controls
Manipulate information.
Properties
Control characteristics like color, caption, size etc.
Methods
Actions that can be performed by object
Events
Action recognized by form or control.
Simple
Consistency
Garbage Collection
Object Orientation
Type Safety
Thread Support
Structured Exceptional Handling
Powerful, Flexible, Simplified Data Access
COM Interoperability
VB .NET VB
Object Oriented Object Based
Data Type Declaration Required Not Strongly Typed
Structured Exception Handling Not Structured
Namespace To Organize Classes Not Supported
Automatic Garbage Collection Not Supported
ADO .NET For DB Connectivity DAO, RDO & ADO
Multithreading Not Supported
Console Applications Are Allowed Not Allowed
New Data Type Like Char, Short & Decimal Not Supported
Variable Can Declare In Same Line Not Allowed
Dim a As Integer = 10
Object Data Type Variant Data Type
VB .NET VB
Fixed Length String Not Allowed Allowed
Array Index Start With O Only Array Index Can Be Changed
Set Keyword Not Supported Set Keyword Used To Assign Object
Variables
Passing By Value Is Default For Calling Pass By Reference
Procedure
Default Properties Of Controls Not Allowed
Allowed
Return Keyword Used To Return Values name = return value Is Used
Optional Argument Must Be Specified Not Necessary
With Default Value
Long
Constant
Value not change during execution of code.
Const a = 45
Identifier
Building block of programming language.
28-11-2014 ANKIT VERMA 25
Scope Of Variables
Block Scope
If block
Procedure Scope
Function
Module
Class variable accessed by all functions
Namespace Scope
Inside namespace
Shadowing
Same variable name in two procedures.
Public
Private
Protected
Friend
Protected Friend
OPRATOR OPERATION
+ Addition
- Subtraction
* Multiplication
/ Float Division
\ Integer Division
^ Exponentiation
Mod Remainder
OPRATOR OPERATION
< Less Than
> Greater Than
= Equality Checking
<> Not Equal To
OPRATOR OPERATION
= Assignment
+= Addition With Assignment
-= Subtraction With Assignment
*= Multiplication With Assignment
/= Floating Division With Assignment
\= Integer Division With Assignment
^= Exponentiation With Assignment
<= Less Than Equal To
>= Greater Than Equal To
OPRATOR OPERATION
AND Return True, If Both Operands True
OR Return True, If One or Both Operands True
NOT Return True, If Reverse Logical Value Of Operand
XOR Return False, If Both Operands Either True Or False
Syntax:
If <condition> Then
[statement]
ElseIf <condition> Then
[statement]
Else
[statement]
EndIf
Example 1:
Example 2:
Syntax:
Select Case <expression>
Case Value
[statement]
Case Value
[statement]
Case Else
[statement]
End Select
Example:
While Loop
For Loop
Syntax:
Do While <condition>
[statement]
Loop
(OR)
Do Until <condition>
[statement]
Loop
NOTE: Do Until loop executes only if statement is False.
28-11-2014 ANKIT VERMA 44
2) Looping : Do Loop
Syntax:
While <condition>
[statement]
End While
Example:
Syntax:
For index = start To end Step 1
[statement]
Next
Example:
Exit
Used to exit from loop
GOTO
Transfer the control to specified label
Stop
Return the program into break mode
End
Terminate the program
Return
Used in function to return the value to the calling method
Example:
Example:
Example:
Preserve
Preserve data without losing when dimension of array change.
Syntax:
Dim a( ) As String
Redim a(5)
Dim b( , ) As Integer
Redim b(3,2)
ReDim Preserve b(3,4)
Example:
Ubound (arrayname)
Determine upper bound of array.
Lbound (arrayname)
Determine lower bound of array.
Add
Add an item.
Insert
Insert an item at specified position.
Remove
Remove an item.
RemoveAt
Remove an item from specified position.
Sort
Sort items.
Count
Count the number of elements.
Example 1:
Example 2:
Example 2 (Output):
Example:
Style
Denote the style & type of buttons to display in message box.
Values
MsgBoxStyle.YesNoCancel
MsgBoxStyle.YesNo
MsgBoxStyle.OkOnly (Default)
MsgBoxStyle.OkCancel
MsgBoxStyle.Exclamation
MsgboxResult.cancel
MsgboxResult.abort
MsgboxResult.retry
MsgboxResult.ignore
MsgboxResult.yes
MsgboxResult.no
Example:
Title
String expression displayed in title bar.
Default Text
Default response when user not provide input.
X, Y Position
Indicate the appearance if input box in screen.
Syntax:
FUNCTION USE
Strcomp Comparison for two strings
Lcase Convert String into Lower case
Ucase Convert String into Upper case
Rtrim Remove trailing spaces
Ltrim Remove leading spaces
Trim Remove both leading & trailing spaces
Mid Return specific number of character
Asc Return ASCII code of first letter in a string
Chr Return character of given ASCII code
Now Return current system date time
or
Example:
Example:
Example:
Button Click
Mouse Click
Creating:
Using
DOUBTS
PRESENTATION BY:
ANKIT VERMA
(IT DEPARTMENT)