Professional Documents
Culture Documents
vb.net - Copy
vb.net - Copy
com
VB.NET
www.kompongsom4u.blogspot.com
VB.NET
VB.NET
Download Free
www.kompongsom4u.blogspot.com
VB.NET
. VB.NET
VB.NET
VB.NET
. Run File
www.kompongsom4u.blogspot.com
VB.NET
. Button Next
www.kompongsom4u.blogspot.com
.
VB.NET
. VB.NET
. Start Button
. All Program ( windows 7 ) > Microsoft Visual Studio 2008
www.kompongsom4u.blogspot.com
VB.NET
. Project
. Visual Studio 2008
. File ( Ctrl + N ) > New Project
-Name : Project
. Windows Forms Application > Click OK
. Project
. File manu
. Save Form / Save All
www.kompongsom4u.blogspot.com
VB.NET
. Interface VB.NET
Form
Solution
Explorer
Property
Toolbox
Design Form
-Property : Toolbox
-Solution Explorer : Project
. Form Run
Form
. Project Menu
. Windows Application Property
Startup Form
www.kompongsom4u.blogspot.com
VB.NET
.
Form
. ( )
.
. File Menu
. Exit
www.kompongsom4u.blogspot.com
VB.NET
. Toolbox
Toolbox
-button
-Label
-Combo box
-Checkbox
Toolbox
-Button
Button
-Label
Form
-Combo box
( Male or Female )
-Textbox
-List box
List box
-Radio Button
Radio Button
-Timer
-ListView
Database
-DateTimePicker
www.kompongsom4u.blogspot.com
VB.NET
. Solution Explorer
Solution Explorer Project Form Module
Project Project Form
10
www.kompongsom4u.blogspot.com
VB.NET
. Property Object
Property Object Toolbox
Button
Property Toolbox
Property Textbox
Property
-Name : Textbox
-BackColor : Textbox
-ForeColor : Textbox
-Font :
Textbox
11
www.kompongsom4u.blogspot.com
VB.NET
Ex.
Dim
Ex.
Dim
-Keyword
as
string
str ,
as
string
:
(Public , Static , Dim ,
-Viable Name
-As
str
Private )
:
: Data_type
-Data_Type :
Ex.
-Public a as integer
-Dim a as string
-private k as long
General Declaration Static Variable
.. ( Scope Of Variable )
(Life
time Variable )
-Global Variable
12
www.kompongsom4u.blogspot.com
VB.NET
- Scope Form
Project
- Life Time : Application
-Ex. Public a as integer
- Scope Form
Project
- Life Time : Application
-Ex. Friend ak as String
- Scope Module
- Life Time : Application
-Ex. Dim/Private c as String
-
Procedure ( Sub Procedure , Function Procedure)
- Keyword Dim
- Scope Procedure
- Life Time : Application
-Ex. Dim c as String
13
www.kompongsom4u.blogspot.com
VB.NET
-
Procedure ( Sub Procedure , Function Procedure)
- Keyword Static
- Scope Procedure
- Life Time : Application
-Ex. Static c as String
..
- Keyword ( dim , Private , Static ,...)
- (223)
As Data_type
. ( Data_Type )
..
..
Byte
8-bit
0 Through 255
Short
16-bit
-32,768 to 32,768
Integer
32-bit
-2,147,483,648 to 2,147,483,648
Single
32-bit
-3,4028235E38 to 3,4028235E38
Long
64-bit
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,808
Double
64-bit
-1,7976931348621E308 to 1,7976931348621E308
Char
16-bit
Boolean
16-bit
true or False
14
www.kompongsom4u.blogspot.com
VB.NET
. Single, Double
15
www.kompongsom4u.blogspot.com
VB.NET
Code :
16
www.kompongsom4u.blogspot.com
VB.NET
Code :
17
www.kompongsom4u.blogspot.com
VB.NET
Code :
18
www.kompongsom4u.blogspot.com
VB.NET
Code :
19
www.kompongsom4u.blogspot.com
VB.NET
Control Structure
. if Statement
. if else Statement
. if else_if Statement
. Select Case Statement
.. IF STATEMENT
20
www.kompongsom4u.blogspot.com
VB.NET
.. IF ESLE STATEMENT
If else Statement If Statement
Expression1 Statement1
if Statement
Syntax
Else
Expression1 Statement 2
21
www.kompongsom4u.blogspot.com
VB.NET
if else Statement
22
www.kompongsom4u.blogspot.com
VB.NET
.. IF ESLE-IF STATEMENT
if-else-if Statement
23
www.kompongsom4u.blogspot.com
VB.NET
Code :
Private Sub bntPayroll_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles bntPayroll.Click
Dim MonH, TueH, WedH, ThuH, FriH, SatH, SunH, OT As Integer
Dim HourlyRate, TotalPay As Single
HourlyRate = Val(txtHR.Text)
MonH = Val(txtMon.Text)
TueH = Val(txtTue.Text)
WedH = Val(txtWed.Text)
ThuH = Val(txtThu.Text)
FriH = Val(txtFri.Text)
SatH = Val(txtSat.Text)
SunH = Val(txtSun.Text)
OT = 0
If MonH > 8 Then
OT = OT + (MonH - 8)
MonH = 8
End If
If TueH > 8 Then
OT = OT + (TueH - 8)
TueH = 8
End If
If WedH > 8 Then
OT = OT + (WedH - 8)
WedH = 8
End If
If ThuH > 8 Then
OT = OT + (ThuH - 8)
ThuH = 8
End If
If FriH > 8 Then
OT = OT + (FriH - 8)
FriH = 8
End If
OT = OT + SatH + SunH
TotalPay = (MonH + TueH + WedH + ThuH + FriH) * HourlyRate + (2 *
HourlyRate * OT)
txtOTH.Text = OT & "Hours"
txtTP.Text = Format(TotalPay, "$#,##0.00")
End Sub
24
www.kompongsom4u.blogspot.com
VB.NET
Select Case
25
www.kompongsom4u.blogspot.com
VB.NET
Select Case
Select Case
. - Need to work harder
. - Average
. - Above Average
. - Good
. - Excellence
26
www.kompongsom4u.blogspot.com
VB.NET
.
Repeat Statement Block Statement
Loop C Loop
. While Loop Statement
Instruction
Computer
Control Variable
Statement
27
www.kompongsom4u.blogspot.com
VB.NET
do While Loop
Execute Statement
Loop
Execute
Textbox
28
www.kompongsom4u.blogspot.com
For loop
Loop
VB.NET
29
www.kompongsom4u.blogspot.com
VB.NET
Textbox
.. Goto Statement
Statement
Loop
Code
30
www.kompongsom4u.blogspot.com
VB.NET
+ DoEvents() Function
-
31
Array
www.kompongsom4u.blogspot.com
VB.NET
Index
Dynamic Array
Location Runtime
Array = 0
-Ubound
Array = 5
Array Index
32
Array
www.kompongsom4u.blogspot.com
VB.NET
33
www.kompongsom4u.blogspot.com
VB.NET
Array
-Listbox
-Textbox Array
-Button Start
-Button Stop
34
VB.NET
Location Runtime
www.kompongsom4u.blogspot.com
.. Dynamic Array
. Dynamic Array
Dynamic Array
Runtime Keyword
Redim Procedure Array
enaHeK)an
A(0)=2
A(1)=4
A(2)=10
A(3)=30
Array
Code Array
35
www.kompongsom4u.blogspot.com
VB.NET
36
www.kompongsom4u.blogspot.com
VB.NET
0
A(0,0)
A(1,0)
A(2,0)
A(3,0)
enaHeKtagtaragdUcxageRkam
1
A(0,1)
A(1,1)
A(2,1)
A(3,1)
2
A(0,2)
A(1,2)
A(2,2)
A(3,2)
3
A(0,3)
A(1,3)
A(2,3)
A(3,3)
4
A(0,4)
A(1,4)
A(2,4)
A(3,4)
Code
37
Array
www.kompongsom4u.blogspot.com
VB.NET
.. Dynamic Array
-
Ex:
enaHeKTTYl)an
LBound(A,1)=0
LBound(A,2)=0
UBound(A,1)=2
UBound(A,2)=3
38
www.kompongsom4u.blogspot.com
VB.NET
Code
39
Array
www.kompongsom4u.blogspot.com
VB.NET
40
www.kompongsom4u.blogspot.com
VB.NET
Function
.. Sub Procedure
41
www.kompongsom4u.blogspot.com
VB.NET
42
www.kompongsom4u.blogspot.com
VB.NET
Keyboard
.. FunctionProcedure
43
www.kompongsom4u.blogspot.com
VB.NET
44
www.kompongsom4u.blogspot.com
VB.NET
VarName :
45
www.kompongsom4u.blogspot.com
46
VB.NET
www.kompongsom4u.blogspot.com
VB.NET
Database Network
Database Database
Microsoft Access , MySQL Server 2008
Form Load
Imports System.Data.SqlClient
Public Class Form1
Private MyConnect As SqlConnection
Private MyCommand As SqlCommand
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
MyConnection = New SqlConnection("Server=KOMPONGSOM4UPC;Database=student;User id=sa;password=1234")
MyConnection.Open()
''txtid.Text = AutoNum()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
47
www.kompongsom4u.blogspot.com
VB.NET
Form Load
Imports System.Data.SqlClient
Public Class Form1
Private MyConnect As SqlConnection
Private MyCommand As SqlCommand
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
MyConnection = New SqlConnection("Server=IP Server;Database=student;User
id=sa;password=1234")
MyConnection.Open()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
Access
Imports System.Data
Imports System.Data.OleDb
48