21
04/07/2010 1 Windows Form programming with VB.Net 2005. 1 Bui Bui 2: : Control Class Control Class – QuQun n lý mã lý mã lnh nh Data type Cu trúc rnhánh Cu trúc Lp Khai báo biến, mng Các phép toán thông dng. Tìm hiu Control Class Windows Form programming with VB.Net 2005. 2 Data type Data type Size Size Range Range Short Short 2 bytes 2 bytes -32,768 32,768 32,767 32,767 UShort UShort 2 bytes 2 bytes 0 0 65,535 65,535 Integer Integer 4 bytes 4 bytes -2,147,483,648 2,147,483,648 2,147,483,647 2,147,483,647 UInteger UInteger 4 bytes 4 bytes 0 0 4,294,967,295 4,294,967,295 Long Long 8 bytes 8 bytes -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 ULong ULong 8 bytes 8 bytes 0 0 18,446,744,073,709,551,615 18,446,744,073,709,551,615 Single Single 4 bytes 4 bytes -3.4028235E+38 3.4028235E+38 3.4028235E+38 3.4028235E+38 Double Double 8 bytes 8 bytes -1.79769313486231E+308 1.79769313486231E+308 1.79769313486231E+308 1.79769313486231E+308 Decimal Decimal 16 bytes 16 bytes values up to +/ values up to +/-79,228 x 1024 79,228 x 1024 Byte Byte 1 byte 1 byte 0 0 255 (no negative numbers) 255 (no negative numbers) SByte SByte 1 byte 1 byte -128 128 127 127 Char Char 16 bytes 16 bytes Any Unicode symbol in the range 0 Any Unicode symbol in the range 0–65,535 65,535 String String 2 bytes per 2 bytes per character character 0 to 2 billion Unicode characters 0 to 2 billion Unicode characters Boolean Boolean 2 bytes 2 bytes True or False True or False Date Date 8 bytes 8 bytes January 1, 0001, January 1, 0001, December 31, 9999 December 31, 9999 Object Object 4 bytes 4 bytes Can cpntain data of any type Can cpntain data of any type

VB.Net2005B2

  • Upload
    bienpn

  • View
    45

  • Download
    0

Embed Size (px)

Citation preview

Page 1: VB.Net2005B2

04/07/2010

1

Windows Form programming with VB.Net 2005. 1

Buổi Buổi 22: : Control Class Control Class –– QuảQuản n lý mã lý mã llệệnhnh

Data type Cấu trúc rẽ nhánh Cấu trúc Lặp Khai báo biến, mảng Các phép toán thông dụng. Tìm hiểu Control Class

Windows Form programming with VB.Net 2005. 2

Data typeData type SizeSize RangeRangeShortShort 2 bytes2 bytes --32,768 32,768 32,76732,767

UShortUShort 2 bytes2 bytes 0 0 65,53565,535IntegerInteger 4 bytes4 bytes --2,147,483,648 2,147,483,648 2,147,483,6472,147,483,647

UIntegerUInteger 4 bytes4 bytes 0 0 4,294,967,2954,294,967,295

LongLong 8 bytes8 bytes --9,223,372,036,854,775,808 to 9,223,372,036,854,775,8079,223,372,036,854,775,808 to 9,223,372,036,854,775,807

ULongULong 8 bytes8 bytes 0 0 18,446,744,073,709,551,61518,446,744,073,709,551,615SingleSingle 4 bytes4 bytes --3.4028235E+38 3.4028235E+38 3.4028235E+383.4028235E+38DoubleDouble 8 bytes8 bytes --1.79769313486231E+308 1.79769313486231E+308 1.79769313486231E+3081.79769313486231E+308DecimalDecimal 16 bytes16 bytes values up to +/values up to +/--79,228 x 102479,228 x 1024

ByteByte 1 byte1 byte 0 0 255 (no negative numbers)255 (no negative numbers)SByteSByte 1 byte1 byte --128 128 127127CharChar 16 bytes16 bytes Any Unicode symbol in the range 0Any Unicode symbol in the range 0––65,53565,535

StringString 2 bytes per 2 bytes per charactercharacter 0 to 2 billion Unicode characters0 to 2 billion Unicode characters

BooleanBoolean 2 bytes2 bytes True or FalseTrue or FalseDateDate 8 bytes8 bytes January 1, 0001, January 1, 0001, December 31, 9999December 31, 9999

ObjectObject 4 bytes4 bytes Can cpntain data of any typeCan cpntain data of any type

Page 2: VB.Net2005B2

04/07/2010

2

Windows Form programming with VB.Net 2005. 3

BiBiếến:n:

* Khai báo biến:Dim <name> as <DataType>Vd: Dim x as Integer

* Khai báo mảng:Dim <name> (so) as <DataType>Vd: Dim Diem(4) as Integer

ReDim diem(5)

Windows Form programming with VB.Net 2005. 4

CáCác c phéphép p toátoán:n:

PhéPhéo o toátoánn Mô tảMô tả++ CộngCộng−− TrừTrừ** NhânNhân// ChiaChia

\\ Chia lấy phần nguyênChia lấy phần nguyên

ModMod Chia lấy phần dưChia lấy phần dư^̂ Lũy thừaLũy thừa&& Nối 2 chuỗiNối 2 chuỗi

Page 3: VB.Net2005B2

04/07/2010

3

Windows Form programming with VB.Net 2005. 5

CáCác c phéphép p toátoán n rúrút t gọgọn:n:

OperationOperation

++ X = X + 6X = X + 6 X += 6X += 6-- X = X X = X –– 66 X X --= 6= 6** X = X * 6X = X * 6 X *= 6X *= 6// X = X / 6X = X / 6 X /= 6X /= 6\\ X = X X = X \\ 66 X X \\= 6= 6^̂ X = X ^ 6X = X ^ 6 X ^= 6X ^= 6

(&)(&) X = X & "ABC"X = X & "ABC" X &= "ABC"X &= "ABC"

Windows Form programming with VB.Net 2005. 6

ToáToán tn tử ử so so sásánh:nh:

OperatorOperator Mô tảMô tả

>> Lớn hơnLớn hơn

<< Nhỏ hơnNhỏ hơn

>=>= Lớn hơn hoặc bằngLớn hơn hoặc bằng

<=<= Lớn hơn hoặc bằngLớn hơn hoặc bằng

== BằngBằng

<><> KhácKhác

Page 4: VB.Net2005B2

04/07/2010

4

Windows Form programming with VB.Net 2005. 7

PhéPhép p toátoán logicn logic

OperatorOperator Mô tảMô tả

NotNot Phủ địnhPhủ định

AndAnd True And True = True True And True = True (TH còn lại là False)(TH còn lại là False)

OrOr False Or False = FalseFalse Or False = False(TH Còn lại là True)(TH Còn lại là True)

XorXor = True 2 vế SS phủ định nhau= True 2 vế SS phủ định nhau= False 2 vế SS Không phủ định nhau= False 2 vế SS Không phủ định nhau

Windows Form programming with VB.Net 2005. 8

CCấấu u trútrúc c rẽ nhárẽ nhánh:nh:

IfIf <ĐK><ĐK> ThenThen[[CáCácc pháphátt bibiểểu]u]

EndEnd IfIf

IfIf <ĐK><ĐK> ThenThen[[CáCácc pháphátt bibiểểu]u]

ElseElse[[CáCácc pháphátt bibiểểu]u]

EndEnd IfIf

IfIf <ĐK><ĐK> ThenThen [[CáCácc pháphátt bibiểểu]u]ElseIfElseIf [[CáCácc pháphátt bibiểểu]u]ElseElse [[CáCácc pháphátt bibiểểu]u]EndEnd IfIf

Page 5: VB.Net2005B2

04/07/2010

5

Windows Form programming with VB.Net 2005. 9

Select CaseSelect Case

Select Case Select Case <<Tên B Tên B ếến>n>Case Case <<Giá trị Giá trị 11>>

[[CáCácc pháphátt bibiểểu]u]Case Case <<Giá trị Giá trị 22>>

[[CáCácc pháphátt bibiểểu]u]……....

Case ElseCase Else[[CáCácc pháphátt bibiểểu]u]

End SelectEnd Select

Windows Form programming with VB.Net 2005. 10

VòVòng lng lặặp vp vớới Fori For

For Each <For Each <Item>Item> In <In <CollectionObject>CollectionObject>[[CáCác c pháphát bit biểểu]u][Exit For][Exit For]

NextNext

For For counter = startcounter = start To To end [end [Step Step stepstep]][[CáCác c pháphát bit biểểu]u][Exit For][Exit For]

NextNext

Page 6: VB.Net2005B2

04/07/2010

6

Windows Form programming with VB.Net 2005. 11

VòVòng lng lặặp vp vớới Do i Do ((kikiểểm tra ĐK rm tra ĐK rồồi thi thựực hic hiệện)n)

Do While <ĐK đúng> dừng khi ĐK sai[Các phát biểu][Exit Do]

Loop

Do Until <ĐK Sai> dừng khi ĐK đúng[Các phát biểu][Exit Do]

Loop

Windows Form programming with VB.Net 2005. 12

VòVòng lng lặặp vp vớới Do i Do ((ththựực hic hiệện tn tốối thii thiểểu u 11 llầần)n)

Do [Các phát biểu][Exit Do]

Loop While <ĐK đúng> ‘ dừng khi ĐK sai

Do [Các phát biểu][Exit Do]

Loop Until <ĐK Sai> ‘dừng khi ĐK đúng

Page 7: VB.Net2005B2

04/07/2010

7

Windows Form programming with VB.Net 2005. 13

Windows Form programming with VB.Net 2005. 14

VDVD

Dim subfolders() As DirectoryInfoDim getDrive As String = cboDrive.SelectedItemsubfolders = New DirectoryInfo(getDrive).GetDirectorieslstData.Items.Clear()Dim subfolder As DirectoryInfoFor Each subfolder In subfolders

lstData.Items.Add(subfolder.FullName)Next

---------------------------------------------------------------------------------------------------

Dim allDrives() As DriveInfo = DriveInfo.GetDrives()Dim d As DriveInfoFor Each d In allDrives

If d.IsReady = True Then'cboDrive.Items.Add("(" & d.VolumeLabel & ") " & d.Name)cboDrive.Items.Add(d.Name)

End IfNext

Page 8: VB.Net2005B2

04/07/2010

8

Windows Form programming with VB.Net 2005. 15

Buổi 2: Contrl ClassBuổi 2: Contrl Class

PropertiesProperties:: Name,Name, Text,Text, BackColor,BackColor, Forcolor,Forcolor, Font,Font,Size,Size, Location,Location, ImageImage

CanFocusCanFocus Chỉ ra khi Focus Passed controlChỉ ra khi Focus Passed controlDock, AnchorDock, Anchor Định dạng khi thiết kếĐịnh dạng khi thiết kếEnableEnable True or False True or False ((cho cho phéphép hay không)p hay không)VisibleVisible True or False True or False ((ẩẩn or hin or hiệện)n)LockedLocked True or FalseTrue or False

EventEvent:: Click,Click, MouseMouse:: MouseMove,MouseMove, MouseDown,MouseDown,MouseUpMouseUp……..

Windows Form programming with VB.Net 2005. 16

Contrl ClassContrl Class

Label,Label, LinkLabelLinkLabelListView,ListView, TreeViewTreeViewCheckBoxCheckBoxRadioButtonRadioButtonTrackBarTrackBarPanelPanelGroupBox,PanelGroupBox,PanelTextBox,RichTextBoxTextBox,RichTextBoxDomainUpdown,DomainUpdown,

NumericUpdownNumericUpdown

TabControlTabControlPictureBoxPictureBoxImageListImageListTimerTimerScrollBarScrollBarProgressbarProgressbarToolTipToolTipNottifyIconNottifyIconMaskedTextBoxMaskedTextBox

Page 9: VB.Net2005B2

04/07/2010

9

Windows Form programming with VB.Net 2005. 17

Label: Label: a. Properties: a. Properties: Autosize: Autosize: True or FalseTrue or False

ButtonButton:: aa.. PropertiesProperties:: TextAlignTextAlign

LinkLabelLinkLabel::aa.. PropertiesProperties::++ LinkColorLinkColor::++ ActiveLinkColorActiveLinkColor::++ LinkVisibleLinkVisible:: TrueTrue oror FalseFalsebb.. EventEvent::+LinkClicked+LinkClicked::SystemSystem..DiagnosticsDiagnostics..ProcessProcess..Start("wwwStart("www..vnnvnn..vn")vn")

Windows Form programming with VB.Net 2005. 18

TextBox:TextBox:

aa.. PropertiesProperties::++ MaxLengthMaxLength:: ChiềuChiều dàidài tốitối đađa++ MultiLineMultiLine:: TrueTrue oror FalseFalse (( xuxuốốngng dòng?dòng? ))++ PasswordCharPasswordChar:: kýký ttựự passwordpassword++ ReadOnlyReadOnly::++ ScrollBarsScrollBars:: đkđk MultilineMultiline == TrueTruebb.. EventEvent::+TextChanged: +TextChanged: The text in TextBox is ChangedThe text in TextBox is Changed+ + KeyDownKeyDown, KeyUp: , KeyUp: e.KeyCodee.KeyCode+ KeyPress: + KeyPress: e.KeyChare.KeyChar+MultiChanged: +MultiChanged: Value of Multiline is ChangedValue of Multiline is Changedc. Method: c. Method: Clear, Copy, Cut, Paste, Clear, Copy, Cut, Paste, FocusFocus

Page 10: VB.Net2005B2

04/07/2010

10

Windows Form programming with VB.Net 2005. 19

ComboBox:ComboBox:

a. Properties: a. Properties: + + Items:Items: xử lý on ListBox (xử lý on ListBox (Add, RemoveAt, ClearAdd, RemoveAt, Clear, ,

Count…) Count…) ++ SelectedIndex:SelectedIndex: chỉ mục hiện hànhchỉ mục hiện hành+ SelectedItem:+ SelectedItem: Item được chọn hiện hànhItem được chọn hiện hành+ Sorted:+ Sorted: True or FalseTrue or False

b. Event:b. Event:++SelectedIndexChanged:SelectedIndexChanged:

Windows Form programming with VB.Net 2005. 20

:ListBox (soạn lại) :ListBox (soạn lại)

aa.. PropertiesProperties::++ ItemsItems:: xửxử lýlý onon ListBoxListBox ((Add,Add, RemoveAt,RemoveAt, ClearClear,,CountCount……))++ MultiColumnMultiColumn:: TrueTrue oror FalseFalse++ SelectedIndexSelectedIndex:: GetGet oror SetSet vềvề chỉchỉ mụcmục hiệnhiện hànhhành++ SelectedItemSelectedItem:: == ListboxListbox..TextText ;;++ SortedSorted:: TrueTrue oror FalseFalse++ SelectionModeSelectionMode:: None,None, One,One, MultiSimpleMultiSimplebb.. EventEvent::+SelectedIndexChanged+SelectedIndexChanged

Page 11: VB.Net2005B2

04/07/2010

11

Windows Form programming with VB.Net 2005. 21

CheckedListBox: (soạn lại)CheckedListBox: (soạn lại)

aa.. PropertiesProperties::++ ItemsItems:: xửxử lýlý onon ListBoxListBox ((Add,Add, RemoveAt,RemoveAt, ClearClear,,CountCount……))bb.. EventEvent::+SelectedIndexChanged+SelectedIndexChanged -- SelectedValueChangedSelectedValueChanged::c. Method:SetItemChecked(index, True/False)GetItemChecked(index) = True/False

Windows Form programming with VB.Net 2005. 22

Ví dụ:Ví dụ:

Page 12: VB.Net2005B2

04/07/2010

12

Windows Form programming with VB.Net 2005. 23

DomainUpdown and NumericUpdown:DomainUpdown and NumericUpdown:

DomainUpdownDomainUpdownaa.. PropertiesProperties::++ ItemsItems:: tậptập hợphợp cáccác nộinội dungdung hiểnhiển thịthị++ SortedSorted:: TrueTrue oror FalseFalse++ WrapWrap:: TrueTrue oror FalseFalse (xoay(xoay vòng)vòng)++ SelectedItem+SelectedItem+ SelectedIndexSelectedIndex:: (=(= ComboBox)ComboBox)

NumericUpdownNumericUpdown::aa.. PropertiesProperties::++ Maximum,Maximum, MinimunMinimun:: giágiá trịtrị [Min[Min……Max]Max]++ ValueValue:: trảtrả vvềề giágiá trịtrị hihiệệnn hàhànhnh++ IncrementIncrement:: ấấnn đđịịnhnh giágiá trịtrị tăngtăng (default=(default=11))

Windows Form programming with VB.Net 2005. 24

Vi Vi dụdụ: DomainUpdown and NumericUpdown: : DomainUpdown and NumericUpdown:

Page 13: VB.Net2005B2

04/07/2010

13

Windows Form programming with VB.Net 2005. 25

DateTimePicker : DateTimePicker :

88.. MonthCalendarMonthCalendar::aa.. PropertiesProperties::++ SelectionRangeSelectionRange..Start,Start, SelectionRangeSelectionRange..EndEnd:: GetGet oror SetSetDateTimeDateTime khikhi ứngứng dụngdụng đượcđược chạychạy

aa.. PropertiesProperties::++ TextText:: ThôngThông tintin ngàyngày thángtháng nămnăm đượcđược chọnchọn+ Value.+ Value.objobj: : obj ở đây là:obj ở đây là: day, month, year, Date, Hour, day, month, year, Date, Hour, minute, second, millisecond, DayofYearm, minute, second, millisecond, DayofYearm, DayofWeek…..DayofWeek…..++ FormatFormat:: Long,Long, Short,Short, Time,Time, CustomCustom++ CustomFormatCustomFormat:: dùdùngng khikhi FormatFormat làlà CustomCustom++ ShowUpDownShowUpDown:: GiốngGiống dạngdạng ……UpdownUpdown ởở trêntrên

Windows Form programming with VB.Net 2005. 26

Ví dụVí dụ: DateTimePicker & MonthCalendar: : DateTimePicker & MonthCalendar:

Page 14: VB.Net2005B2

04/07/2010

14

Windows Form programming with VB.Net 2005.

Value Description

d Day of month as digits with no leading zero for single-digit days.

dd Day of month as digits with leading zero for single-digit days.

ddd Day of week as a three-letter abbreviation.

dddd Day of week as its full name.

M Month as digits with no leading zero for single-digit months.

MM Month as digits with leading zero for single-digit months.

MMM Month as a three-letter abbreviation.

MMMM Month as its full name.

y Year as last two digits, with no leading zero for years less than 10.

yy Year as last two digits, with a leading zero for years less than 10.

yyyy Year represented by full four digits.

Windows Form programming with VB.Net 2005.

Value Description

h Hours with no leading zero for single-digit hours; 12-hour clock

hh Hours with leading zero for single-digit hours; 12-hour clock

H Hours with no leading zero for single-digit hours; 24-hour clock

HH Hours with leading zero for single-digit hours; 24-hour clock

m Minutes with no leading zero for single-digit minutes

mm Minutes with leading zero for single-digit minutes

s Seconds with no leading zero for single-digit seconds

ss Seconds with leading zero for single-digit seconds

t One character time marker string, such as A or P

tt Multicharacter time marker string, such as AM or PM

Page 15: VB.Net2005B2

04/07/2010

15

Windows Form programming with VB.Net 2005. 29

TimerTimer

aa.. PropertiesProperties::++ IntervalInterval:: mômô tảtả chuchu kỳkỳ thờithời giangian inin MillisecondsMilliseconds giữagiữamỗimỗi nhịpnhịp (tick)(tick) củacủa timertimer (default=(default=100100))bb.. EventEvent::++ TickTick:: thựcthực khikhi thờithời giangian IntervalInterval trôitrôi quaqua vàvà timertimertimertimer isis enabledenabledbb.. MethodMethod::++ StartStart:: StartsStarts thethe timertimer whenwhen timertimer isis enabledenabled++ StopStop:: StopsStops thethe timertimer ifif itit hashas beenbeen alreadyalready startedstarted

ImageList: ImageList: a. Propertiesa. Properties: + Images: : + Images: lưu danh lưu danh sách các Imagesách các Image

Windows Form programming with VB.Net 2005. 30

PictureBox:PictureBox:

ImageList: ImageList: a. Propertiesa. Properties: : + Images: + Images: quảquản n lý lý ttậập hp hợợp các Imagep các Image+ Images.(Index): + Images.(Index): Index Index củcủa Image đa Image đượược setc set+ Images.Count: + Images.Count: ssố ố Image trong ImageListImage trong ImageList+ ImageSize: + ImageSize: kíkích thch thướước Image (default c Image (default 1616xx1616))

a.a.PropertiesProperties+ + ImageLocationImageLocation: : đđườường dng dẫẫn n 1 1 Image cImage cầần hin hiểển n thịthị+ Image: + Image: Get or Set Image tGet or Set Image từ ừ ImageList hoImageList hoặặc tc từ ừ resource khi thiresource khi thiếết kt kế ế + SizeMode:+ SizeMode: cácách image đch image đượược hic hiểển n thịthị

Page 16: VB.Net2005B2

04/07/2010

16

Windows Form programming with VB.Net 2005. 31

Vd: Timer Vd: Timer -- PictureBox PictureBox -- ImageList: ImageList:

Windows Form programming with VB.Net 2005. 32

99. ProgressBar . ProgressBar

aa.. PropertiesProperties::++ MaximumMaximum:: MaxMax ValueValue ofof ProgresBarProgresBar++ MinimumMinimum:: MinMin ValueValue ofof ProgresBarProgresBar++ ValueValue:: VịVị trítrí hiệnhiện tạitại củacủa cursorcursor trongtrong ProgresBarProgresBar++ StepStep:: mômô tảtả giágiá trịtrị == PerformStepPerformStep methodmethodbb.. MethodMethod::++ IncrementIncrement:: didi chuyểnchuyển vịvị trítrí ofof ProgresBarProgresBar == cáchcách tăngtăngvaluevalue+PerformStep+PerformStep:: didi chuyểnchuyển vịvị trítrí ofof ProgresBarProgresBar == cáchcách chỉchỉrara valuevalue inin StepStep

Page 17: VB.Net2005B2

04/07/2010

17

Windows Form programming with VB.Net 2005. 33

99. TrackBar . TrackBar

aa.. PropertiesProperties::++ MaximumMaximum:: MaxMax ValueValue ofof ProgresBarProgresBar++ MinimumMinimum:: MinMin ValueValue ofof ProgresBarProgresBar++ ValueValue:: VịVị trítrí hiệnhiện tạitại củacủa cursorcursor trongtrong ProgresBarProgresBar++ TickStyleTickStyle:: địnhđịnh dạngdạng TrackBarTrackBarbb.. EventEvent::++ ScorllScorll:: ThựcThực thithi khikhi didi chuyểnchuyển TrackBarTrackBar+Valuechanged+Valuechanged:: ThựcThực thithi khikhi ValueValue isis changedchanged

Windows Form programming with VB.Net 2005. 34

Vd: TrackBar: Vd: TrackBar:

Page 18: VB.Net2005B2

04/07/2010

18

Windows Form programming with VB.Net 2005. 35

Panel and GroupBox:Panel and GroupBox:

PanelPanel andand GroupBoxGroupBox ControlControl chủchủ yếuyếu đểđể chứachứa cáccáccontrolcontrol kháckhác vàovào cùngcùng mộtmột nhómnhóm đểđể thựcthực hiệnhiện táctác vụvụnhằmnhằm thuậnthuận lợilợi chocho việcviệc quảnquản lýlý côngcông việcviệc trongtrong lậplậptrình,trình, thườngthường làlà cáccác CheckBox,CheckBox, RadioButtonRadioButton……

CheckBoxCheckBox andand RadioButtonRadioButtonaa.. PropertiesProperties::++ CheckedChecked:: TrueTrue oror FalseFalse (kiểm(kiểm tratra check)check)bb.. EventEvent::++ CheckedChangedCheckedChanged:: khikhi controlcontrol đượcđược checkcheck

GhiGhi chúchú:: mmộộtt GroupGroup checkboxcheckbox cócó ththểể chọchọnn objectobject nhinhiềềuu nhưngnhưng RadioButtonRadioButton thìthì chỉchỉ chọchọnn 11

Windows Form programming with VB.Net 2005. 36

Vd: Group controlVd: Group control

Page 19: VB.Net2005B2

04/07/2010

19

Windows Form programming with VB.Net 2005. 37

TabControl:TabControl:

aa.. PropertiesProperties::++ TabCountTabCount:: TrueTrue oror FalseFalse (kiểm(kiểm tratra check)check)++ TabPagesTabPages:: dùngdùng kiểmkiểm soátsoát vàvà tạoTabpagetạoTabpage++ TabIndexTabIndex:: TrảTrả vvềề IndexIndex củcủaa TabPageTabPage ((00……nn--11))++ SelectedIndexSelectedIndex:: GetGet oror SetSet TabIndexTabIndex hihiệệnn hàhànhnhbb.. EventEvent::++ SelectedIndexChangedSelectedIndexChanged:: thựcthực thithi SelectedIndexSelectedIndex đđượượcc thaythay đđổổii

Windows Form programming with VB.Net 2005. 38

Ví dụVí dụ: : cácác Group controlc Group control

Page 20: VB.Net2005B2

04/07/2010

20

Windows Form programming with VB.Net 2005. 39

ListView:ListView:

aa.. PropertiesProperties::++ ColumnsColumns:: QuảQuảnn lýlý CCộộtt củcủaa ListViewListView++ ItemsItems:: SSốố dòdòngng vàvà cácácc thàthànhnh phphầầnn củcủaa dòdòngng++ ViewView:: LargeIcon,LargeIcon, SmallIcon,SmallIcon, Detail,Detail, ListList++ GroupGroup:: dùdùngng chiachia nhónhómm theotheo ViewView++ MultiselectMultiselect:: TrueTrue oror FalseFalse++ SortingSorting:: ((Ascending,Ascending, DescendingDescending))bb.. EventEvent::++ ColumnClickColumnClick:: ththựựcc thithi khikhi ccộộtt đđượượcc clickclickcc.. MethodMethod::++ ClearClear:: xóxóaa ttấấ cảcả cácácc ItemItem trongtrong ListViewListView

Windows Form programming with VB.Net 2005. 40

TreeView:TreeView:

aa.. PropertiesProperties::+HotTracking+HotTracking::TrueTrue oror FalseFalse ((hihiểểnn thịthị Hyperlink)Hyperlink)++ NodesNodes:: kikiểểmm soásoátt cácácc NodeNode trongtrong mmộộtt TreeTree+ImageIndex: +ImageIndex: chỉ chỉ ra Index of a Image in ImageListra Index of a Image in ImageList++ ImageListImageList:: DanhDanh sásáchch ImageImage cócó ththểể hihiểểnn thịthị++ SelectedNodeSelectedNode:: GiữGiữ NodeNode hiệnhiện hànhhành đượcđược chọnchọn++ CheckBoxesCheckBoxes:: cócó thêmthêm checkcheck boxbox trongtrong TreeViewTreeView

bb.. MethodMethod::++ CollapseAll,CollapseAll, ExpandAllExpandAll:: cheche llấấpp,, mmởở rrộộngng++ GetNodeCountGetNodeCount:: trảtrả vvềề ssốố NodeNode ofof TreeTree

Page 21: VB.Net2005B2

04/07/2010

21

Windows Form programming with VB.Net 2005. 41

TreeView:TreeView:

cc.. EventEvent::

++ AfterCheck,AfterCheck, BeforeCheckBeforeCheck::

++ AfterCollapse,AfterCollapse, BeforeCollapseBeforeCollapse::

++ AfterExpand,AfterExpand, BeforeExpandBeforeExpand::

++ AfterSelect,AfterSelect, BeforeSelectBeforeSelect ::