'____________________________________________________________________________________
'代码出处:http://zhidao.baidu.com/link?url=5jNl-JvbrmGsIXVSTLfSJsAsUh5S5Y4qCxBm71wviCrxUOVsiujCDGSGKjZ7zWohDKyaedT9zn7bi-uxyTllu_
Private Const LB_GETTEXT = &H189
Private Const LB_GETCOUNT = &H18B
Private Declare Function SendMessageBynum& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Private Declare Function SendMessageByString& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String)
Private Sub Command1_Click()
Text1.Text = SendMessageBynum&(List1.hwnd, LB_GETCOUNT, 0&, 0&) '取总行数
Dim a As String * 255
SendMessageByString& List1.hwnd, LB_GETTEXT, 0, a '0表示第一行,以此类推
Text2.Text = a '取第一行的文本
End Sub
'____________________________________________________________________________________
'____________________________________________________________________________________
Private Sub Command1_Click()
End Sub
'___________________________________选中list第一行___________________________________
'____________________________________________________________________________________
list1.list(List1.ListIndex) 'list1选中行文字
list1.list(0) 'list1第一行文字
list1.list(List1.ListCount) 'list1最后一行文字
List1.ListCount 'list1总行数
List1.ListIndex 'list1选中行行数
'____________________________________________________________________________________