AboutSyed Rizwan Muhammad Rizvi Expertise I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.
Experience Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.
Question Hello Sir,
Assalamu Alaikum,
with due respect and honour,
i create my project which consist treeview in vb 6, and know i need to use either listview or text box to show result of node click as i see it in most of the programs, i tried my best adding some code to this one but it give me error, the code below shows the treeview and nodes correctly is there any help in order to see the my result of node click in either listview or text box below is my code as follows:
Option Explicit
Dim conn As Adodb.Connection
Dim rec As Adodb.Recordset, esql As String
Dim nodx As node, nodY As node
Private Sub Command1_Click()
Do While Not rec.EOF
Set nodx = TreeView1.Nodes.Add(, "Root", , rec.Fields(0), 1)
Set nodY = TreeView1.Nodes.Add(nodx.Index, tvwChild, , rec.Fields(1), 2)
rec.MoveNext
Loop
rec.Close
End Sub
Private Sub Form_Load()
Set conn = New Adodb.Connection
Set rec = New Adodb.Recordset
conn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb;Persist Security Info=False")
esql = "select * from customers"
rec.Open (esql), conn, adOpenStatic, adLockReadOnly
TreeView1.ImageList = ImageList1
End Sub
_________________________
any help please will be appreciated.
thanks and best regards.
Answer W.Salam,
Please let me know what error are you getting exactly and at what line of code.
And I assume that if you want to add child nodes you will have to change your code to:
Set nodx = TreeView1.Nodes.Add(, "Root", , rec.Fields(0), 1)
Set nodY = nodx.Nodes.Add( tvwChild, , rec.Fields(1), 2)
Please verify the syntax as I don't have vb6 available on my laptop right now.