SlideShare ist ein Scribd-Unternehmen logo
1 von 97
-
2/2554
GUI Visual
Basic 2008
GUI
-–
–
1.
2.
1/2
1.
2.
2/2554
1
1.1
5
1.2
5
1.3 6
1.4
7
1.5
7
1.6 8
1.7
9
2
2.1 Visual Basic
10
2.2 Microsoft office Access 2007
21
3
3.1 MS Access 2007
28
3.2
32
3.3
36
4
4.1
72
5
5.1
80
5.2 80
1.1
Basic
Microsoft Office Access
Database server
1.2.
1.
2.
1.3.



















1.4
..
..
..
..
..
1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3
-
--
6
1. Software
---
--
- Microsoft Windows 7
- Microsoft Visual Basic 2008
2. Hardware-
- NOTEBOOK Toshiba Sate
- Hard Disk 320 GB
- DDR RAMS 512 MB
- CD/RW ROM 52X Toshiba
- ATI Mobility Radeon Premium Graphics
- Monitor “14”
1.7
2
2.1 Visual Basic
BASIC Thomas Kurtz
Interpreter
GW-BASIC Interpreter
DOS
Sub Program
User Defind QUICK BASIC Visual Basic
QUICK
BASIC PDS BASIC Microsoft
BASIC Visual Basic
Visual Basic
Windows Visual
GUI : Graphic
User Interface) BASIC Beginner All-
Purpose Symbolic Instruction Code ) Visual
Basic VB Visaul Basic.net VB.NET)
Microsoft Visual Studio .NET)
Windows Operating System)
Dotnet Framework)
UML = Unified Modeling
Language) Visual Studio .NET)
IDE = Integrated Development Environment)
SQL Server) Visaul Basic.net VB.NET)
VC#) VJ#) VC++)
ASP .NET)
CLR = Common Language
Runtime)
Visual Basic Programming
Language)
Windows 95/98
Windows NT
Basic
Beginner’s All Purpose Symbolic Instruction
“ ” Basic
C).
Pascal) Fortian) Assembler)
Basic
MBASIC (Microsoft Basic). BASICA (Basic
Advanced): GWBASIC QuickBasic
Ms DOS
QBASIC
Text Mode
Windows
Windows
DOS
Text Mode
Basic
Windows
Visual Basic
Visual Basic 1.0
1991
GBASIC
Visual Basic
Visual Basic
(debugger)
(MDI)
Visual Basic Visual Studio 2010
2010
Object
Oriented Programming)
2.1.1 Visual Basic
Visual Basic
Visual Basic
1.
2. Basic
3.
4. Visual Basic
Visual Basic
Visual Basic
Visual Basic 2008 Visual
Basic 2008
Visual Basic
2005 Visual Basic
2008
Visual Basic 6 VB2008
Visual Basic 2008
Visual Basic 6
2.1.2 Visual Basic
2008
New project
2.1.2.1 Menu Bar
VB
Project
Build
Debug
Data
Format
2.1.2.2 Standard Toolbar
2.1.2.3 Solution Explorer
item
2.1.2.4 Properties
Object
2.1.2.5 Toolbox
Toolbox
Toolbox
Toolbox
toolbox 7
Common Controls
textbox
Containers
GroupBox Panel
Menu & ToolBars toolbar
Data
Components
Timer
, SerialPort
Printing
Dialogs Dialog
2.1.2.6 Run
Standard
Toolbar F5
2.1.3 Tool Box
Tool Box Control ( User Interface
(User Interface
2.1.3.1 code
View --> Code F7
2.1.3.2 Code
Public Class Form1 Class
Form1 class sub function
Code
2.1.3.4
File > new
project
dialog box 5
windows application
Windwos FormsApplication
Name: WindowsApplication1
MyFirstProgram
OK IDE Visual
Basic 6 Form common
controls toolbox, Solution explorer properties
button toolbox Form Calculate
calcuate source
code
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim num1, num2, sum As Single
num1 = 100
num2 = 200
sum = num1 + num2
MsgBox(" The Sum of " & num1 & " and " & num2 & " is "
& sum)
End Sub
play
)
2.2 Microsoft office Access 2007
Database System)
2.2.1
-
--
-
--
-
2.2.2 Access 2007
-
-
-
-
2.2.3
-
-
-
-
-
-
-
Normalization
- Data
Type)
- Relationship)
-
2.2.4 Access 2007
-
2.2.5 Access 2007
-
-
Table)
-
Query)
-
Form)
- Report)
PivotTable )
-
(Template) (Wizard)
-
Windows SharePoint Services
A c c e s s 2 0 0 7
Windows SharePoint Services Access 2007
2.2.6
1. Title Bar
2. Control Button
3. Quick Access Toolbar
4. Ribbon
Access
5. Office Button
6.
7. Design
View, Normal View
2.2.7
2.2.7.1 Form)
Form)
Table Datasheet)
2.2.7.2
-
-
-
-
----
VBA (Visual Basic for Applicatio
ns)
2.2.7.3 3
1.
2.
3.
2.2.7.4
1.
2. Create)
3. Form
2.2.7.5 Form Wizard )
1. Create)
2. More Form)
Form Wizard
3. tbl_product
4.
5. Next)
6. Columnar)
7. Next)
8.
9. Next)
10. Frm_product
11. Finish)
3.1.1 Ms Access 2007
id Text 255
name1 Text 255
add1 Text 255
tel Text 255
3 1.1
idcar Text 255
brand Text 255
gen Text 255
bortyear Text 255
price Number Integer
detailcar Text 255
num Number Integer
3 1.2
Idrent1 Text 255
Id Text 255
name Text 255
add Text 255
Tel Text 255
Idcar Text 255
Brand Text 255
Gen Text 255
bortyear Text 255
Price Number Integer
detailcar1 Text 255
amount Number Integer
pledeg Number Integer
Night Date/Time Long Date
status1 Text 255
3 1.3
Idreat Text 255
Idcar Text 255
Id Text 255
Amount Number Integer
Night Date/Time Long Date
3 1.4
3.2
Form4
Form1
Form9
Form6
3.3
FormCustomer
Fowchart
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Enabled = True
If TextBox1.Text = "" Then
MessageBox.Show(" ")
Exit Sub
End If
If ComboBox1.Text = " " Then
sql = "select * from customer where id='" & TextBox1.Text & "'"
With rs
.CommandType = CommandType.Text
.CommandText = sql
.Connection = conn
dr = .ExecuteReader
End With
dr.Read()
If dr.HasRows Then
TextBox2.Text = dr.Item("id")
TextBox3.Text = dr.Item("name1")
TextBox4.Text = dr.Item("add1")
TextBox5.Text = dr.Item("tel")
Else
MessageBox.Show(" ")
Call Button5_Click(Nothing, Nothing)
End If
dr.Close()
Else
sql = "select * from customer where name1 like'%" &
TextBox1.Text & "%'"
With rs
.CommandType = CommandType.Text
.CommandText = sql
.Connection = conn
dr = .ExecuteReader
End With
dr.Read()
If dr.HasRows Then
TextBox2.Text = dr.Item("id")
TextBox3.Text = dr.Item("name1")
TextBox4.Text = dr.Item("add1")
TextBox5.Text = dr.Item("tel")
Else
MessageBox.Show(" ")
Call Button5_Click(Nothing, Nothing)
End If
dr.Close()
End If
End Sub
Fowchart
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = ""
Or TextBox5.Text = "" Then
MessageBox.Show(" ")
Exit Sub
End If
sql = "insert into customer(id,name1,add1,tel) values('" &
TextBox2.Text & "','" & TextBox3.Text & "' , '" & TextBox4.Text & "', '" &
TextBox5.Text & "')"
With rs
.CommandText = sql
.Connection = conn
.ExecuteNonQuery()
End With
MessageBox.Show(" ", " ")
Call Button5_Click(Nothing, Nothing)
End Sub
Fowchart
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
sql = "update customer set id='" & TextBox2.Text & "',name1='" &
TextBox3.Text & "', add1='" & TextBox4.Text & "', tel='" & TextBox5.Text &
"' where id='" & TextBox1.Text & "'"
With rs
.CommandText = sql
.ExecuteNonQuery()
End With
MessageBox.Show(" ", " ")
Call Button5_Click(Nothing, Nothing)
End Sub
Fowchart
No
Yes
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
If MessageBox.Show(" ", " OH CAR",
MessageBoxButtons.YesNo, MessageBoxIcon.Error) = MsgBoxResult.Yes Then
sql = "delete * from customer where id='" & TextBox1.Text & "'"
With rs
.CommandText = sql
.ExecuteNonQuery()
End With
MessageBox.Show(" ", " ")
Call Button5_Click(Nothing, Nothing)
Else
Exit Sub
End If
End Sub
Fowchart
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
Form Car
Fowchart
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If TextBox3.Text = "" Then
MessageBox.Show(" ")
Exit Sub
End If
sql = "select * from car where idcar='" & TextBox3.Text & "'"
With rs
.CommandType = CommandType.Text
.CommandText = sql
.Connection = conn
dr = .ExecuteReader
End With
dr.Read()
If dr.HasRows Then
TextBox1.Text = dr.Item("idcar")
ComboBox5.Text = dr.Item("brand")
ComboBox1.Text = dr.Item("gen")
ComboBox2.Text = dr.Item("bortyear")
TextBox5.Text = dr.Item("price")
TextBox2.Text = dr.Item("detailcar")
TextBox4.Text = dr.Item("num")
Else
MessageBox.Show(" ")
End If
dr.Close()
End Sub
Fowchart
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
If TextBox1.Text = "" Or ComboBox5.Text = "" Or ComboBox1.Text = ""
Or ComboBox2.Text = "" Or TextBox5.Text = "" Or TextBox2.Text = "" Then
MessageBox.Show(" ")
Exit Sub
End If
sql = "insert into
car(idcar,brand,gen,bortyear,price,detailcar,num) values('" & TextBox1.Text
& "','" & ComboBox5.Text & "' ,"
sql &= " '" & ComboBox1.Text & "','" & ComboBox2.Text & "','" &
CInt(TextBox5.Text) & "', '" & TextBox2.Text & "','" & CInt(TextBox4.Text)
& "')"
With rs
.CommandText = sql
.Connection = conn
.ExecuteNonQuery()
End With
MessageBox.Show(" ", " ")
Call Button3_Click(Nothing, Nothing)
End Sub
Fowchart
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
sql = "update car set idcar='" & TextBox1.Text & "',brand='" &
ComboBox5.Text & "', gen= "
sql &= "'" & ComboBox1.Text & "', bortyear='" & ComboBox2.Text & "'
,price='" & CInt(TextBox5.Text) & "' "
sql &= ",detailcar='" & TextBox2.Text & "' ,num='" & TextBox4.Text
& "'where idcar='" & TextBox1.Text & "'"
With rs
.CommandText = sql
.Connection = conn
.ExecuteNonQuery()
End With
MessageBox.Show(" ", " ")
End Sub
Fowchart
No
Yes
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox5.Text = ""
ComboBox5.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
End Sub
Form Rent
Fowchart
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
If TextBox3.Text = "" Then
MessageBox.Show(" ")
Exit Sub
End If
Sql = "select * from car where idcar='" & TextBox3.Text & "'"
With rs
.CommandType = CommandType.Text
.CommandText = Sql
.Connection = conn
dr = .ExecuteReader
End With
dr.Read()
If dr.HasRows Then
TextBox1.ReadOnly = True
TextBox1.Text = dr.Item("idcar")
ComboBox5.Text = dr.Item("brand")
ComboBox1.Text = dr.Item("gen")
ComboBox2.Text = dr.Item("bortyear")
ComboBox4.Text = dr.Item("price")
TextBox2.Text = dr.Item("detailcar")
Else
MessageBox.Show(" ")
End If
dr.Close()
End Sub
Fowchart
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button7.Click
If TextBox12.Text = "" Then
MessageBox.Show(" ")
Exit Sub
End If
sql = "select * from car where idcar='" & TextBox12.Text & "'"
With rs
.CommandType = CommandType.Text
.CommandText = sql
.Connection = conn
dr = .ExecuteReader
End With
dr.Read()
If dr.HasRows Then
TextBox11.Text = dr.Item("idcar")
ComboBox5.Text = dr.Item("brand")
ComboBox1.Text = dr.Item("gen")
ComboBox2.Text = dr.Item("bortyear")
TextBox13.Text = dr.Item("price")
TextBox2.Text = dr.Item("detailcar")
tmp = dr.Item("num")
Else
MessageBox.Show(" ")
End If
dr.Close()
End Sub
Fowchart
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
If TextBox7.Text = "" Or ComboBox5.Text = "" Or ComboBox1.Text = ""
Or ComboBox2.Text = "" Or TextBox13.Text = "" Or TextBox11.Text = "" Or
TextBox6.Text = "" Or TextBox5.Text = "" Or TextBox4.Text = "" Or
TextBox3.Text = "" Or TextBox2.Text = "" Then
MessageBox.Show(" ")
Exit Sub
End If
sql = "insert into
rent1(idrent,id,name1,add1,tel,idcar,brand,gen,bortyear,price,detailcar1,am
ount,pledeg,night,status1)"
sql &= "values('" & TextBox7.Text & "','" & TextBox3.Text & "','" &
TextBox4.Text & "',"
sql &= "'" & TextBox5.Text & " ','" & TextBox6.Text & "','" &
TextBox11.Text & "',"
sql &= "'" & ComboBox5.Text & "', '" & ComboBox1.Text & "','" &
ComboBox2.Text & "',"
sql &= "'" & CInt(TextBox13.Text) & "','" & TextBox2.Text & "','" &
CInt(TextBox10.Text) & "',"
sql &= "'" & CInt(TextBox9.Text) & "','" &
DateTimePicker1.Value.ToLongDateString & "','1')"
With rs
.CommandText = sql
.Connection = conn
.ExecuteNonQuery()
End With
tmp = 0
sql = "update car set num='" & tmp & "' where idcar='" &
TextBox12.Text & "'"
With rs
.CommandText = sql
.Connection = conn
.ExecuteNonQuery()
End With
MessageBox.Show(" ", " ")
Call Button3_Click(Nothing, Nothing)
End Sub
Fowchart
No
Yes
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox4.Text = ""
ComboBox5.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
End Sub
Form Returns
Fowchart
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox2.Enabled = False
TextBox3.Enabled = False
TextBox4.Enabled = False
TextBox5.Enabled = False
If TextBox1.Text = "" Then
MsgBox(" ", MsgBoxStyle.Critical, " ")
Exit Sub
End If
sql = " select
rent1.id,rent1.idcar,rent1.amount,rent1.night,car.num from rent1,car where
rent1.idrent='" & TextBox1.Text & "'"
sql &= " and rent1.status1='1'"
sql &= " and rent1.idcar=car.idcar"
With rs
.CommandType = CommandType.Text
.CommandText = sql
.Connection = conn
dr = .ExecuteReader
End With
dr.Read()
If dr.HasRows Then
TextBox2.Text = dr.Item("id")
TextBox3.Text = dr.Item("idcar")
TextBox4.Text = dr.Item("amount")
TextBox5.Text = dr.Item("night")
tmp = dr.Item("num")
Else
MsgBox(" ", MsgBoxStyle.Exclamation,
" ")
End If
dr.Close()
End Sub
Fowchart
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
If TextBox1.Text = "" Or TextBox6.Text = "" Or TextBox7.Text = ""
Or TextBox8.Text = "" Then
MsgBox(" ")
Exit Sub
End If
sql = " update rent1 set status1='0'"
sql &= "where idrent = '" & TextBox1.Text & "'"
With rs
.Connection = conn
.CommandText = sql
.ExecuteNonQuery()
End With
tmp = CInt(TextBox4.Text) + tmp
sql = "Update car set num='" & tmp & "'"
sql &= " where idcar='" & TextBox3.Text & "'"
With rs
.Connection = conn
.CommandText = sql
.ExecuteNonQuery()
End With
sql = "insert into returns(idreat,idcar,id,amount,night)"
sql &= " values('" & TextBox1.Text & "','" & TextBox3.Text & "','"
& TextBox2.Text & "',"
sql &= "'" & CInt(TextBox4.Text) & "','" & TextBox5.Text & "')"
With rs
.CommandText = sql
.Connection = conn
.ExecuteNonQuery()
End With
MsgBox(" ")
Call Button4_Click(Nothing, Nothing)
End Sub
Fowchart
No
Yes
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
End Sub
4.1 Form
1.
2.
3.
4.
5.
6.
1.
2.
3.
4.
5.
1.
2.
3.
1.
2.
3.
4.
5.
1.
2.
3.
4.
5.
1.
2.
1.
2.
1.
2.
3.
ICT
1.
2.
3.
–
–
http://th.carrenthatyai.com/
Visual Basic”
, " Advanced Visual
Basic 6.0",
, , 2548.
. : 1 2550
.
http://www.thaigoodview.com/library/teachershow/lopburi/c
hayamon_b/.
http://www.lks.ac.th/kuanjit/menu_vb.htm.
DVD 35
DVD 13
DVD 10

Weitere ähnliche Inhalte

Andere mochten auch

บทที่ 3 การใช้งานคอนโทรล
บทที่ 3 การใช้งานคอนโทรลบทที่ 3 การใช้งานคอนโทรล
บทที่ 3 การใช้งานคอนโทรล
MareenaHahngeh
 
Weddingphotographerssanfrancisco
WeddingphotographerssanfranciscoWeddingphotographerssanfrancisco
Weddingphotographerssanfrancisco
walterskemp
 
Prototype and test assignment prototype 2
Prototype and test assignment   prototype 2Prototype and test assignment   prototype 2
Prototype and test assignment prototype 2
Paul Kneipp
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
MareenaHahngeh
 

Andere mochten auch (15)

Slide share
Slide shareSlide share
Slide share
 
บทที่ 3 การใช้งานคอนโทรล
บทที่ 3 การใช้งานคอนโทรลบทที่ 3 การใช้งานคอนโทรล
บทที่ 3 การใช้งานคอนโทรล
 
Template politician no
Template politician noTemplate politician no
Template politician no
 
How to bet against a stock
How to bet against a stockHow to bet against a stock
How to bet against a stock
 
Weddingphotographerssanfrancisco
WeddingphotographerssanfranciscoWeddingphotographerssanfrancisco
Weddingphotographerssanfrancisco
 
TeRento.mx
TeRento.mxTeRento.mx
TeRento.mx
 
Prototype and test assignment prototype 2
Prototype and test assignment   prototype 2Prototype and test assignment   prototype 2
Prototype and test assignment prototype 2
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
Aratt felicita | Begur Road Appartments | bangalore apartments for sale
Aratt felicita | Begur Road Appartments | bangalore apartments for saleAratt felicita | Begur Road Appartments | bangalore apartments for sale
Aratt felicita | Begur Road Appartments | bangalore apartments for sale
 
บท6
บท6บท6
บท6
 
Pagina Dos
Pagina DosPagina Dos
Pagina Dos
 
Michael pivola artwork file powerpoint
Michael pivola artwork file  powerpointMichael pivola artwork file  powerpoint
Michael pivola artwork file powerpoint
 
Willams manor| flats for sale in cochin
Willams manor| flats for sale in cochinWillams manor| flats for sale in cochin
Willams manor| flats for sale in cochin
 
Slidesnack
SlidesnackSlidesnack
Slidesnack
 
Aeris brochure| Flats in IndiraNagar, Bangalore| Arattukulam Developers
Aeris brochure| Flats in IndiraNagar, Bangalore| Arattukulam DevelopersAeris brochure| Flats in IndiraNagar, Bangalore| Arattukulam Developers
Aeris brochure| Flats in IndiraNagar, Bangalore| Arattukulam Developers
 

Ähnlich wie โครงการ 5 บท

Inventory management
Inventory managementInventory management
Inventory management
Rajeev Sharan
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
AustinaGRPaigey
 

Ähnlich wie โครงการ 5 บท (20)

Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
 
Inventory management
Inventory managementInventory management
Inventory management
 
Produce nice outputs for graphical, tabular and textual reporting in R-Report...
Produce nice outputs for graphical, tabular and textual reporting in R-Report...Produce nice outputs for graphical, tabular and textual reporting in R-Report...
Produce nice outputs for graphical, tabular and textual reporting in R-Report...
 
[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...[FT-7][snowmantw] How to make a new functional language and make the world be...
[FT-7][snowmantw] How to make a new functional language and make the world be...
 
Moving to the NoSQL side: MySQL JSON functions
 Moving to the NoSQL side: MySQL JSON functions Moving to the NoSQL side: MySQL JSON functions
Moving to the NoSQL side: MySQL JSON functions
 
The Ring programming language version 1.5.3 book - Part 27 of 184
The Ring programming language version 1.5.3 book - Part 27 of 184The Ring programming language version 1.5.3 book - Part 27 of 184
The Ring programming language version 1.5.3 book - Part 27 of 184
 
VB Dot net
VB Dot net VB Dot net
VB Dot net
 
The Ring programming language version 1.5.2 book - Part 11 of 181
The Ring programming language version 1.5.2 book - Part 11 of 181The Ring programming language version 1.5.2 book - Part 11 of 181
The Ring programming language version 1.5.2 book - Part 11 of 181
 
CRUD VB2010
CRUD VB2010CRUD VB2010
CRUD VB2010
 
Vb.net Experiment with Example
Vb.net Experiment with ExampleVb.net Experiment with Example
Vb.net Experiment with Example
 
Software Language Design & Engineering
Software Language Design & EngineeringSoftware Language Design & Engineering
Software Language Design & Engineering
 
The Ring programming language version 1.7 book - Part 14 of 196
The Ring programming language version 1.7 book - Part 14 of 196The Ring programming language version 1.7 book - Part 14 of 196
The Ring programming language version 1.7 book - Part 14 of 196
 
please code in c#- please note that im a complete beginner- northwind.docx
please code in c#- please note that im a complete beginner-  northwind.docxplease code in c#- please note that im a complete beginner-  northwind.docx
please code in c#- please note that im a complete beginner- northwind.docx
 
Colegio municipal
Colegio municipalColegio municipal
Colegio municipal
 
Ditec esoft C# project
Ditec esoft C# projectDitec esoft C# project
Ditec esoft C# project
 
Ditec esoft C# project
Ditec esoft C# project Ditec esoft C# project
Ditec esoft C# project
 
The Ring programming language version 1.5.4 book - Part 42 of 185
The Ring programming language version 1.5.4 book - Part 42 of 185The Ring programming language version 1.5.4 book - Part 42 of 185
The Ring programming language version 1.5.4 book - Part 42 of 185
 
.net progrmming part4
.net progrmming part4.net progrmming part4
.net progrmming part4
 
Basic NLP with Python and NLTK
Basic NLP with Python and NLTKBasic NLP with Python and NLTK
Basic NLP with Python and NLTK
 
The Ring programming language version 1.8 book - Part 32 of 202
The Ring programming language version 1.8 book - Part 32 of 202The Ring programming language version 1.8 book - Part 32 of 202
The Ring programming language version 1.8 book - Part 32 of 202
 

Mehr von MareenaHahngeh (16)

ขั้นตอนการสร้าง Presentation กับโปรแกรม go animate
ขั้นตอนการสร้าง Presentation กับโปรแกรม go animateขั้นตอนการสร้าง Presentation กับโปรแกรม go animate
ขั้นตอนการสร้าง Presentation กับโปรแกรม go animate
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
Slidesnack
SlidesnackSlidesnack
Slidesnack
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
Slide share
Slide shareSlide share
Slide share
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
งานนำเสนอ
งานนำเสนองานนำเสนอ
งานนำเสนอ
 
Doc1
Doc1Doc1
Doc1
 
Doc1
Doc1Doc1
Doc1
 
โค้ด
โค้ดโค้ด
โค้ด
 
Doc1
Doc1Doc1
Doc1
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บท
 

Kürzlich hochgeladen

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

โครงการ 5 บท

  • 2.
  • 6. 1 1.1 5 1.2 5 1.3 6 1.4 7 1.5 7 1.6 8 1.7 9 2 2.1 Visual Basic 10 2.2 Microsoft office Access 2007 21 3
  • 7. 3.1 MS Access 2007 28 3.2 32 3.3 36 4 4.1 72 5 5.1 80 5.2 80
  • 12. - Microsoft Windows 7 - Microsoft Visual Basic 2008 2. Hardware- - NOTEBOOK Toshiba Sate - Hard Disk 320 GB - DDR RAMS 512 MB - CD/RW ROM 52X Toshiba - ATI Mobility Radeon Premium Graphics - Monitor “14”
  • 13. 1.7
  • 14. 2 2.1 Visual Basic BASIC Thomas Kurtz Interpreter GW-BASIC Interpreter DOS Sub Program User Defind QUICK BASIC Visual Basic
  • 15. QUICK BASIC PDS BASIC Microsoft BASIC Visual Basic Visual Basic Windows Visual GUI : Graphic User Interface) BASIC Beginner All- Purpose Symbolic Instruction Code ) Visual Basic VB Visaul Basic.net VB.NET) Microsoft Visual Studio .NET) Windows Operating System) Dotnet Framework) UML = Unified Modeling Language) Visual Studio .NET) IDE = Integrated Development Environment) SQL Server) Visaul Basic.net VB.NET) VC#) VJ#) VC++) ASP .NET)
  • 16. CLR = Common Language Runtime) Visual Basic Programming Language) Windows 95/98 Windows NT Basic Beginner’s All Purpose Symbolic Instruction “ ” Basic C). Pascal) Fortian) Assembler) Basic MBASIC (Microsoft Basic). BASICA (Basic Advanced): GWBASIC QuickBasic Ms DOS QBASIC Text Mode Windows Windows DOS Text Mode
  • 17. Basic Windows Visual Basic Visual Basic 1.0 1991 GBASIC Visual Basic Visual Basic (debugger) (MDI) Visual Basic Visual Studio 2010 2010 Object Oriented Programming) 2.1.1 Visual Basic
  • 18. Visual Basic Visual Basic 1. 2. Basic 3. 4. Visual Basic Visual Basic Visual Basic
  • 19. Visual Basic 2008 Visual Basic 2008 Visual Basic 2005 Visual Basic 2008 Visual Basic 6 VB2008 Visual Basic 2008 Visual Basic 6
  • 20. 2.1.2 Visual Basic 2008 New project 2.1.2.1 Menu Bar VB Project
  • 23. toolbox 7 Common Controls textbox Containers GroupBox Panel Menu & ToolBars toolbar Data Components Timer
  • 24. , SerialPort Printing Dialogs Dialog 2.1.2.6 Run Standard Toolbar F5 2.1.3 Tool Box Tool Box Control ( User Interface (User Interface
  • 25. 2.1.3.1 code View --> Code F7 2.1.3.2 Code Public Class Form1 Class Form1 class sub function
  • 27. dialog box 5 windows application Windwos FormsApplication Name: WindowsApplication1 MyFirstProgram OK IDE Visual Basic 6 Form common controls toolbox, Solution explorer properties
  • 28. button toolbox Form Calculate
  • 29. calcuate source code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim num1, num2, sum As Single num1 = 100 num2 = 200 sum = num1 + num2 MsgBox(" The Sum of " & num1 & " and " & num2 & " is " & sum) End Sub
  • 31. 2.2 Microsoft office Access 2007 Database System)
  • 34. - 2.2.5 Access 2007 - - Table) - Query) - Form) - Report) PivotTable ) - (Template) (Wizard) - Windows SharePoint Services A c c e s s 2 0 0 7
  • 35. Windows SharePoint Services Access 2007 2.2.6 1. Title Bar 2. Control Button 3. Quick Access Toolbar 4. Ribbon Access 5. Office Button 6.
  • 36. 7. Design View, Normal View 2.2.7 2.2.7.1 Form) Form) Table Datasheet) 2.2.7.2 - - - -
  • 37. ---- VBA (Visual Basic for Applicatio ns) 2.2.7.3 3 1. 2. 3. 2.2.7.4 1. 2. Create) 3. Form 2.2.7.5 Form Wizard )
  • 38. 1. Create) 2. More Form) Form Wizard 3. tbl_product 4. 5. Next)
  • 41. id Text 255 name1 Text 255 add1 Text 255 tel Text 255 3 1.1
  • 42. idcar Text 255 brand Text 255 gen Text 255 bortyear Text 255 price Number Integer detailcar Text 255 num Number Integer 3 1.2
  • 43. Idrent1 Text 255 Id Text 255 name Text 255 add Text 255 Tel Text 255 Idcar Text 255 Brand Text 255 Gen Text 255 bortyear Text 255 Price Number Integer detailcar1 Text 255 amount Number Integer pledeg Number Integer Night Date/Time Long Date status1 Text 255 3 1.3
  • 44. Idreat Text 255 Idcar Text 255 Id Text 255 Amount Number Integer Night Date/Time Long Date 3 1.4
  • 46. Form1
  • 47. Form9
  • 48. Form6
  • 51. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Enabled = True If TextBox1.Text = "" Then MessageBox.Show(" ") Exit Sub End If If ComboBox1.Text = " " Then sql = "select * from customer where id='" & TextBox1.Text & "'" With rs .CommandType = CommandType.Text .CommandText = sql .Connection = conn dr = .ExecuteReader End With dr.Read() If dr.HasRows Then TextBox2.Text = dr.Item("id") TextBox3.Text = dr.Item("name1") TextBox4.Text = dr.Item("add1") TextBox5.Text = dr.Item("tel") Else MessageBox.Show(" ") Call Button5_Click(Nothing, Nothing) End If dr.Close() Else sql = "select * from customer where name1 like'%" & TextBox1.Text & "%'" With rs .CommandType = CommandType.Text .CommandText = sql .Connection = conn dr = .ExecuteReader End With dr.Read() If dr.HasRows Then TextBox2.Text = dr.Item("id") TextBox3.Text = dr.Item("name1") TextBox4.Text = dr.Item("add1") TextBox5.Text = dr.Item("tel") Else MessageBox.Show(" ") Call Button5_Click(Nothing, Nothing) End If dr.Close() End If End Sub
  • 53. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Then MessageBox.Show(" ") Exit Sub End If sql = "insert into customer(id,name1,add1,tel) values('" & TextBox2.Text & "','" & TextBox3.Text & "' , '" & TextBox4.Text & "', '" & TextBox5.Text & "')" With rs .CommandText = sql .Connection = conn .ExecuteNonQuery() End With MessageBox.Show(" ", " ") Call Button5_Click(Nothing, Nothing) End Sub
  • 55. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click sql = "update customer set id='" & TextBox2.Text & "',name1='" & TextBox3.Text & "', add1='" & TextBox4.Text & "', tel='" & TextBox5.Text & "' where id='" & TextBox1.Text & "'" With rs .CommandText = sql .ExecuteNonQuery() End With MessageBox.Show(" ", " ") Call Button5_Click(Nothing, Nothing) End Sub
  • 57. Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click If MessageBox.Show(" ", " OH CAR", MessageBoxButtons.YesNo, MessageBoxIcon.Error) = MsgBoxResult.Yes Then sql = "delete * from customer where id='" & TextBox1.Text & "'" With rs .CommandText = sql .ExecuteNonQuery() End With MessageBox.Show(" ", " ") Call Button5_Click(Nothing, Nothing) Else Exit Sub End If End Sub
  • 59. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" TextBox5.Text = "" End Sub
  • 62. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox3.Text = "" Then MessageBox.Show(" ") Exit Sub End If sql = "select * from car where idcar='" & TextBox3.Text & "'" With rs .CommandType = CommandType.Text .CommandText = sql .Connection = conn dr = .ExecuteReader End With dr.Read() If dr.HasRows Then TextBox1.Text = dr.Item("idcar") ComboBox5.Text = dr.Item("brand") ComboBox1.Text = dr.Item("gen") ComboBox2.Text = dr.Item("bortyear") TextBox5.Text = dr.Item("price") TextBox2.Text = dr.Item("detailcar") TextBox4.Text = dr.Item("num") Else MessageBox.Show(" ") End If dr.Close() End Sub
  • 64. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click If TextBox1.Text = "" Or ComboBox5.Text = "" Or ComboBox1.Text = "" Or ComboBox2.Text = "" Or TextBox5.Text = "" Or TextBox2.Text = "" Then MessageBox.Show(" ") Exit Sub End If sql = "insert into car(idcar,brand,gen,bortyear,price,detailcar,num) values('" & TextBox1.Text & "','" & ComboBox5.Text & "' ," sql &= " '" & ComboBox1.Text & "','" & ComboBox2.Text & "','" & CInt(TextBox5.Text) & "', '" & TextBox2.Text & "','" & CInt(TextBox4.Text) & "')" With rs .CommandText = sql .Connection = conn .ExecuteNonQuery() End With MessageBox.Show(" ", " ") Call Button3_Click(Nothing, Nothing) End Sub
  • 66. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click sql = "update car set idcar='" & TextBox1.Text & "',brand='" & ComboBox5.Text & "', gen= " sql &= "'" & ComboBox1.Text & "', bortyear='" & ComboBox2.Text & "' ,price='" & CInt(TextBox5.Text) & "' " sql &= ",detailcar='" & TextBox2.Text & "' ,num='" & TextBox4.Text & "'where idcar='" & TextBox1.Text & "'" With rs .CommandText = sql .Connection = conn .ExecuteNonQuery() End With MessageBox.Show(" ", " ") End Sub
  • 68. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ComboBox1.Text = "" ComboBox2.Text = "" TextBox5.Text = "" ComboBox5.Text = "" TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" TextBox4.Text = "" End Sub
  • 71. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox3.Text = "" Then MessageBox.Show(" ") Exit Sub End If Sql = "select * from car where idcar='" & TextBox3.Text & "'" With rs .CommandType = CommandType.Text .CommandText = Sql .Connection = conn dr = .ExecuteReader End With dr.Read() If dr.HasRows Then TextBox1.ReadOnly = True TextBox1.Text = dr.Item("idcar") ComboBox5.Text = dr.Item("brand") ComboBox1.Text = dr.Item("gen") ComboBox2.Text = dr.Item("bortyear") ComboBox4.Text = dr.Item("price") TextBox2.Text = dr.Item("detailcar") Else MessageBox.Show(" ") End If dr.Close() End Sub
  • 73. Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click If TextBox12.Text = "" Then MessageBox.Show(" ") Exit Sub End If sql = "select * from car where idcar='" & TextBox12.Text & "'" With rs .CommandType = CommandType.Text .CommandText = sql .Connection = conn dr = .ExecuteReader End With dr.Read() If dr.HasRows Then TextBox11.Text = dr.Item("idcar") ComboBox5.Text = dr.Item("brand") ComboBox1.Text = dr.Item("gen") ComboBox2.Text = dr.Item("bortyear") TextBox13.Text = dr.Item("price") TextBox2.Text = dr.Item("detailcar") tmp = dr.Item("num") Else MessageBox.Show(" ") End If dr.Close() End Sub
  • 75. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click If TextBox7.Text = "" Or ComboBox5.Text = "" Or ComboBox1.Text = "" Or ComboBox2.Text = "" Or TextBox13.Text = "" Or TextBox11.Text = "" Or TextBox6.Text = "" Or TextBox5.Text = "" Or TextBox4.Text = "" Or TextBox3.Text = "" Or TextBox2.Text = "" Then MessageBox.Show(" ") Exit Sub End If sql = "insert into rent1(idrent,id,name1,add1,tel,idcar,brand,gen,bortyear,price,detailcar1,am ount,pledeg,night,status1)" sql &= "values('" & TextBox7.Text & "','" & TextBox3.Text & "','" & TextBox4.Text & "'," sql &= "'" & TextBox5.Text & " ','" & TextBox6.Text & "','" & TextBox11.Text & "'," sql &= "'" & ComboBox5.Text & "', '" & ComboBox1.Text & "','" & ComboBox2.Text & "'," sql &= "'" & CInt(TextBox13.Text) & "','" & TextBox2.Text & "','" & CInt(TextBox10.Text) & "'," sql &= "'" & CInt(TextBox9.Text) & "','" & DateTimePicker1.Value.ToLongDateString & "','1')"
  • 76. With rs .CommandText = sql .Connection = conn .ExecuteNonQuery() End With tmp = 0 sql = "update car set num='" & tmp & "' where idcar='" & TextBox12.Text & "'" With rs .CommandText = sql .Connection = conn .ExecuteNonQuery() End With MessageBox.Show(" ", " ") Call Button3_Click(Nothing, Nothing) End Sub Fowchart
  • 77. No Yes Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ComboBox1.Text = "" ComboBox2.Text = "" ComboBox4.Text = "" ComboBox5.Text = "" TextBox1.Text = "" TextBox2.Text = "" TextBox3.Text = "" End Sub
  • 80. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox2.Enabled = False TextBox3.Enabled = False TextBox4.Enabled = False TextBox5.Enabled = False If TextBox1.Text = "" Then MsgBox(" ", MsgBoxStyle.Critical, " ") Exit Sub End If sql = " select rent1.id,rent1.idcar,rent1.amount,rent1.night,car.num from rent1,car where rent1.idrent='" & TextBox1.Text & "'" sql &= " and rent1.status1='1'" sql &= " and rent1.idcar=car.idcar" With rs .CommandType = CommandType.Text .CommandText = sql .Connection = conn dr = .ExecuteReader End With dr.Read() If dr.HasRows Then
  • 81. TextBox2.Text = dr.Item("id") TextBox3.Text = dr.Item("idcar") TextBox4.Text = dr.Item("amount") TextBox5.Text = dr.Item("night") tmp = dr.Item("num") Else MsgBox(" ", MsgBoxStyle.Exclamation, " ") End If dr.Close() End Sub Fowchart
  • 82. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If TextBox1.Text = "" Or TextBox6.Text = "" Or TextBox7.Text = "" Or TextBox8.Text = "" Then MsgBox(" ") Exit Sub End If sql = " update rent1 set status1='0'" sql &= "where idrent = '" & TextBox1.Text & "'" With rs .Connection = conn .CommandText = sql .ExecuteNonQuery() End With tmp = CInt(TextBox4.Text) + tmp sql = "Update car set num='" & tmp & "'" sql &= " where idcar='" & TextBox3.Text & "'" With rs .Connection = conn .CommandText = sql .ExecuteNonQuery() End With sql = "insert into returns(idreat,idcar,id,amount,night)" sql &= " values('" & TextBox1.Text & "','" & TextBox3.Text & "','" & TextBox2.Text & "',"
  • 83. sql &= "'" & CInt(TextBox4.Text) & "','" & TextBox5.Text & "')" With rs .CommandText = sql .Connection = conn .ExecuteNonQuery() End With MsgBox(" ") Call Button4_Click(Nothing, Nothing) End Sub Fowchart No
  • 84. Yes Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() TextBox4.Clear() TextBox5.Clear() TextBox6.Clear() TextBox7.Clear() End Sub
  • 91. 1. 2.
  • 92. 1. 2.
  • 94.
  • 96. – – http://th.carrenthatyai.com/ Visual Basic” , " Advanced Visual Basic 6.0", , , 2548. . : 1 2550 . http://www.thaigoodview.com/library/teachershow/lopburi/c hayamon_b/.