ListBox - Özellikler
Appeance
BackColor
CausesValidation
Columns
Container
DataChanged
DataField
DataFormat
DataMember
DataSource
DragIcon
DragMode
Enabled
Font
FontBold
FontItalıc
FontName
FontSize
FontStrikethru
FontUnderline
ForeColor
Height
HelpContextID
HideSelection
HWnd
Index
IntegralHeight
ItemData
Left
List
ListCount
ListIndex
ListItem
MouseIcon
MousePointer
MultiSelect
Name
NewIndex
OleDragMode
Parent
RightToLeft
SelCount
Selected
Sorted
Style
TabIndex
TabStop
Tag
Text
ToolTipText
Top
TopIndex
Visible
WhatsThisHelpID
Width
Columns : Sütun sayısı ( 0 - 1 sütün, 1 - 2 sütun )
IntegralHeight : ListBox boyutun font büyüklüğüne göre ayarlanması
List : Dizi değişken. ListBox'da yer alan elemanlar
ListCount : ListBox'daki eleman sayısı
ListIndex : Seçili elemanın sıra numarası
ListItem : Listede seçili olan elemanın sırası (-1 Seçim yok,
0 İlk eleman seçili)
MultiSelect : Aynı anda birden fazla seçim yapılıp yapılamayacağı
SelCount : Seçili eleman sayısı
Selected : Seçilmesi istenen eleman
Sorted : ListBox içerisinde sıralama yapılıp yapılmayacağı
Style : ListBox'un stili
ListBox - Olaylar
Click
DblClick
DragDrop
DragOver
GotFocus
ItemCheck KeyDown
KeyPress
LostFocus
MouseDown
MouseMove
MouseUp
OleCompleteDrag
OleDragDrop
OleDragOver
OleGiveFeedBack
OleSetData
OleStartDrag
Scroll
Validate
ListBox - Yöntemler
AddItem
Clear
Drag
Move
NewIndex
*******
RemoveItem
SetFocus
ShowWhatsThis
TopIndex
ZOrder
AddItem : Listeye ekleme
Clear : Listenin tamamının silme
NewIndex : Listeye eklenen son elemanın indeks numarası
RemoveItem : Listeden silme
TopIndex : Görülen en üstteki elemanın indeks numarası
Text Dosya İçeriğini ListBox’a Eklemek
Private Sub Command1_Click()
Dim Eklenecek As String
Open "c:\sil.txt" For Input As #1
List1.Clear
While Not EOF(1)
Input #1, Eklenecek
List1.AddItem Eklenecek
Wend
List1.*******
Close #1
End Sub
TextBox İçeriğini ListBox’a Eklemek
(General)(Declaration)
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
lParam As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(hpvDest As Any, hpvSource As Any, ByVal cbCopy As Long)
Const EM_GETLINECOUNT = &HBA
Const EM_GETLINE = &HC4
Private Sub Command1_Click()
Dim lCount As Long, l As Long, i As Integer, k As Long, a$
lCount = SendMessage(Text1.hwnd, EM_GETLINECOUNT, 0, ByVal 0)
If lCount = 0 Then Exit Sub
ReDim aLines(1 To lCount) As String
i = 512
a$ = Space$(512)
List1.Clear
For l = 0 To lCount - 1
Call CopyMemory(ByVal a$, i, 2)
k = SendMessage(Text1.hwnd, EM_GETLINE, l, ByVal a$)
aLines(l + 1) = Left$(a$, k)
List1.AddItem aLines(l + 1)
Next
End Sub
