Hello,
I orginally thought of using the listview.index value to determine the set.
It turned out that it is possible to do this another way. If you have Wrox
Professional VB6 Databases. On p347 and 339, you should find a good example
listed in there. Although it is in N-Tier solution format, it should cover
it all.
Basically you set a recordset using
Set rsEmpoyee = New ADODB.Recordset
then
Set rsEmployee = objEmployee.Select_Employee(ListView.SelectedItem.Key)
This SelectEmployee Function
Public Function Select_Employee(Optional emp_id As String) As Object
Dim strSQL As String
strSQl = 'Select * From employee'
If trim("" & emp_id) <> "" Then
strSQL = strSQL & " WHERE emp_id = '" & emp_id & "'"
End If
Set Select_Employee = cnEmployee.Execute(strSQL)
returns a object rather than a database. The list view control is suppose to
'maintain and expose the key of the item clicked'. Henec we have
ListView1.SelectedItem.Key. This key is then passed on to the select
function
To update following text boxes use:
txtEmpID = rsEmployee("emp_id")
txtFname = rsEmployee("fname")
....
...
..
.
Set rsEmployee = Nothing
It looks like a long way to do this, but it does work. I am still playing
around withthe idea of using a Index term.
Hoping this will help!
Richard Wang
----- Original Message -----
From: Fredrick J. Krantz <krunch97@m...>
To: professional vb <pro_vb@p...>
Sent: Tuesday, May 16, 2000 3:24 PM
Subject: [pro_vb] list view boxes with headings and rows
> Has anyone written any code that loads a list view with headings and
> selects from it to select from the list in it. If possible could you
> forward a sample of the code to load a list with 2 columnns and does a dbl
> click to select from the list view box.
>
> thanks.
>