You are on page 1of 23

04/07/2010

Gii Thiu:

Lp trnh ng dng Windows Form in VB.Net 2005


Thi lng: 45 tit LT 30 tit TH GV: Phm nh Sc Email: sacvn@yahoo.com or dinhsac@gmail.com

Windows Form programming with VB.Net 2005.

Bui 1: Nhp mn Lp trnh VB.Net 2005


Mt s qui nh cho mn hc Cch ci t Visual Studio.Net Gii thiu .Net FrameWork Gii thiu Visual Basic.Net Khi ng VB.Net Cc thnh phn giao din VB.Net Tm hiu v Windows Form Vit chng trnh u tin

Windows Form programming with VB.Net 2005.

04/07/2010

Mt s qui nh
Trong qu trnh hc, nu c g khng hiu th phi hi ngay nht l trong gi thc hnh. Gii lao ? Gio trnh VB.net 2005 ? Ti liu v Bi tp: 9 http://dinhsac.4shared.com/ 9 Email: vbnet05@gmail.com pass: cdktcndn Kim tra qu trnh khng thng bo trc Kt thc mn hc 2 2-3 SV/nhm lm n mn hc c th dng thay thi ht mn
Windows Form programming with VB.Net 2005.
3

B ci t Visual Basic.Net 2005


Microsoft .NET Framework 2.0 (22 22. .4 MB) Download MS Visual Basic 2005 Express Edition ( (436 436MB) MB) Download MS Visual Web Developer 2005 (ISO File, 440 MB) Download MS SQL Server 2005 Express Edition ( (54 54 MB) Download
Windows Form programming with VB.Net 2005.
4

04/07/2010

Cch ci t Visual Studio.Net


Mua b a Visual Studio.Net 2005 2005: : gm 4 a a a s 1 vo a CD: chng trnh s yu cu chn mt th mc lu cc tp tin c gii nn. Ta chn th mc v nhn OK. Lm tng t nh a s 1 cho cc a cn li. Lu : Ch nh vo cng mt th mc. Sau khi gii nn xong c 4 a. Ta tin hnh ci t IIS cho windows.

Windows Form programming with VB.Net 2005.

Cch ci t Visual Studio.Net

- Ci t IIS: IIS:
Vo Start All Programe Control Panel Vo Add or Remove Programe Add/Remove Windows Components nh du chn vo mc chn Internet Information Services (IIS). Nh hnh:

Windows Form programming with VB.Net 2005.

04/07/2010

Cch ci t Visual Studio.Net


Sau nhn Next. (Windows s yu cu a a ci t Windows vo) Ch chng trnh ci t IIS.

Windows Form programming with VB.Net 2005.

Cch ci t Visual Studio.Net


- Vo th mc vs chy tp tin autorun.exe

Windows Form programming with VB.Net 2005.

04/07/2010

Cch ci t Visual Studio. Studio.Net


Sau khi chy tp tin autorun autorun. .exe mn hnh hin ra nh sau sau: :

Windows Form programming with VB.Net 2005.

Cch ci t Visual Studio. Studio.Net

Windows Form programming with VB.Net 2005.

10

04/07/2010

Cch ci t Visual Studio. Studio.Net


- Sau nhn Next.

Windows Form programming with VB.Net 2005.

11

Cch ci t Visual Studio.Net


Sau nhn Next.

Windows Form programming with VB.Net 2005.

12

04/07/2010

Cch ci t Visual Studio. Studio.Net


- Sau nhn Full v chn Next Next. .

Windows Form programming with VB.Net 2005.

13

Cch ci t Visual Studio.Net


- By gi hy ch cho n khi chng trnh thng bo ci t thnh cng.

Windows Form programming with VB.Net 2005.

14

04/07/2010

Cch ci t Visual Studio.Net


- By gi ta tin hnh ci t th vin MSDN

Windows Form programming with VB.Net 2005.

15

Cch ci t Visual Studio.Net


- Ta chn Next.

Windows Form programming with VB.Net 2005.

16

04/07/2010

Cch ci t Visual Studio. Studio.Net


- Chn I accept v chn Next.

Windows Form programming with VB.Net 2005.

17

Cch ci t Visual Studio. Studio.Net


- Ta chn Next.

Windows Form programming with VB.Net 2005.

18

04/07/2010

Cch ci t Visual Studio. Studio.Net


- Chn Full v chn Next.

Windows Form programming with VB.Net 2005.

19

Cch ci t Visual Studio. Studio.Net


- Chn th mc ci t MSDN v chn Next

Windows Form programming with VB.Net 2005.

20

10

04/07/2010

Cch ci t Visual Studio. Studio.Net


- Chn Install

Windows Form programming with VB.Net 2005.

21

Cch ci t Visual Studio. Studio.Net


- Chng trnh bt u ci t.

Windows Form programming with VB.Net 2005.

22

11

04/07/2010

Cch ci t Visual Studio. Studio.Net


- Chng trnh thng bo ci t thnh cng.

Windows Form programming with VB.Net 2005.

23

Gii thiu Visual Studio

Microsoft .NET Framework Microsoft Visual Basic. Basic.NET Microsoft CShap CShap. .NET (C#) Microsoft JShap JShap. .NET (J#) Microsoft Visual C++

Windows Form programming with VB.Net 2005.

24

12

04/07/2010

Gii thiu .Net FrameWork


Microsoft .NET Framework l mi trng tng tc v qun l vic pht trin ng dng ng. . Net FrameWork ch nh vng nh lu tr d liu, qun l quyn trong vic thc thi ng dng, qun l vic bin dch v thc thi ng dng ng. . Net Frame Work bao gm hai thnh phn chnh chnh: : 9Common Language Runtime (CLR) 9Net FrameWork class library

Windows Form programming with VB.Net 2005.

25

Gii thiu .Net FrameWork


Common Language Runtime Runtime: : Qun l vic thc thi ca ng dng. ng. CLR cung cp cc dch v nh: bin dch lnh (code), ch nh vng nh, qun l lung (thread) v qun l b gm rc (garbage collection),.. collection), .. gip m bo mi trng cho cc ng dng thc thi. thi.

Windows Form programming with VB.Net 2005.

26

13

04/07/2010

Gii thiu .Net FrameWork


Net FrameWork class library: Cung cp cc lp th vin cn thit tng tc vi CLR. Cc lp th vin (class library) c t chc thnh cc khng gian tn (NameSpase (NameSpase). ). Mt khng gian tn l mt nhm logic cc loi c cng chc nng. System. .Windows Windows. .Forms cha cc V d, NameSpase System loi dng to nn Windows Form v c dng trong nhng form ny. ny. namespase tn c t chc c th bc. c. NameSpase gc ca .Net FrameWork l System

Windows Form programming with VB.Net 2005.

27

Gii thiu .Net FrameWork


Net FrameWork c thit k cc ngn ng tch hp vi nhau. nhau. C ngha l mt ng dng c vit bng ngn ng VB VB. .Net c th tham chiu n (reference) n th vin lin kt ng (DLL) c vit bng ngn ng C# hoc c vit bng Microsoft Visual C++ hoc bt k ngn ng lp trnh .Net khc khc. .

Windows Form programming with VB.Net 2005.

28

14

04/07/2010

Gii thiu .Net FrameWork


Khi mt ng dng c bin dch t ngn ng vit ng dng sang Microsoft Intermediate Language (MSIL hoc IL). IL). MSIL l ngn ng cp thp, CLR c th hiu c. c. VB. .Net s nguyn l Integer, trong C# V d, trong VB s nguyn l Int; Int; khi bin dch c hai kiu s nguyn ny s c bin dch thnh m IL c dng System. System.Int Int32 32. . Do d d dng giao tip qua li gia hai ngn ng ny ny. .
Windows Form programming with VB.Net 2005.
29

Gii thiu VB VB. .Net


Visual Basic Basic. .NET (VB (VB. .NET) l ngn ng lp trnh hng i tng (Object Oriented Programming Language) do Microsoft thit k. Visual Basic Basic. .NET (VB. (VB .NET) l mt ngn ng lp trnh hon ton mi trn nn Microsoft's .NET Framework Framework. . Visual Basic Basic. .NET (VB (VB. .NET) gip ta i ph vi cc phc tp khi lp trnh trn nn Windows v do , ta ch tp trung vo cc vn lin quan n d n, cng vic hay doanh nghip. p.

Windows Form programming with VB.Net 2005.

30

15

04/07/2010

Khi ng VB.Net
-.

Windows Form programming with VB.Net 2005.

31

Windows Form programming with VB.Net 2005.

32

16

04/07/2010

To mi mt project VB VB. .net

Windows Form programming with VB.Net 2005.

33

Giao din tng qut

Windows Form programming with VB.Net 2005.

34

17

04/07/2010

ToolBox - Server Explorer Properties - Solution Explorer Tt c trong View Menu Help
Windows Form programming with VB.Net 2005.
35

Gii Thiu Windows Form: Form:


Windows Form c th l l: : Standard Windows Multiple Document Interface (MDI) windows Dialog Boxes Chng ta s tm hiu 1 s thnh phn quan trng ca Form Form: : Properties, Method, Event
Windows Form programming with VB.Net 2005.
36

18

04/07/2010

1. Properties Properties: :
Property l mt trong nhng khi nim quan trng ca .NET, n nh hng n giao din ca Form Form: : Name Nhn dng Form Text Tiu Form BackColor,Background Mu, hnh nn ca Form ForeColor Mu Font ca Form Font Font cho cc object trn Form Enabled True or False MaximumSize MaximumSize-MinimumSize WindowState Normal, Maximized, Minimized
Windows Form programming with VB.Net 2005.
37

1. Properties Properties: : Size (Width, Height)

Windows Form programming with VB.Net 2005.

38

19

04/07/2010

1. Properties Properties: : Location (x,y)

Windows Form programming with VB.Net 2005.

39

2. Method Method: :
Method l Fuontions c MS tch hp sn sng dng trong MS. MS. VS VS. .Net Net: : Close Hide Show Activate ng Form n Form Hin Form Kch hot Form

Windows Form programming with VB.Net 2005.

40

20

04/07/2010

3. Event Event: : s kin t ng thc thi


Load Activated FormClosing FormClosed Deactivate Thc khi trc khi Form c Load Form c kch hot hoc c set Focus Thc thi khi Form ang ng Thc thi khi Form c ng Thc thi khi Form Loss Focus hoc not the active Form

Mt s Event v Mouse: MouseMove, MouseDown, MouseUp.


Windows Form programming with VB.Net 2005.
41

Chng trnh u tin tin: :


Vit chng trnh tm s 7 may mn: n:

Windows Form programming with VB.Net 2005.

42

21

04/07/2010

Chng trnh u tin tin: :


Double Click Form Form: : Randomize() Double Click Button End End: : Me Me. .Close() Double Click Button Spin: Spin: PictureBox1 PictureBox 1.Visible = False Label1 Label 1.Text = CStr(Int(Rnd() * 10 10)) )) Label2 Label 2.Text = CStr(Int(Rnd() * 10 10)) )) Label3 Label 3.Text = CStr(Int(Rnd() * 10 10)) )) If (Label (Label1 1.Text = "7") Or (Label (Label2 2.Text = "7") _ Or (Label (Label3 3.Text = "7") Then PictureBox1 PictureBox 1.Visible = True End If
Windows Form programming with VB.Net 2005.
43

Chng trnh u tin tin: :


Double Click Button Spin: Spin: PictureBox1 PictureBox 1.Visible = False Label1 Label 1.Text = CStr(Int(Rnd() * 10 10)) )) Label2 Label 2.Text = CStr(Int(Rnd() * 10 10)) )) Label3 Label 3.Text = CStr(Int(Rnd() * 10 10)) )) If (Label (Label1 1.Text = "7") Or (Label (Label2 2.Text = "7") _ Or (Label (Label3 3.Text = "7") Then PictureBox1 PictureBox 1.Visible = True End If

Windows Form programming with VB.Net 2005.

44

22

04/07/2010

Windows Form programming with VB.Net 2005.

45

23

You might also like