Coba dech ini :


Private Sub Form_Load()
Call BuildTree(Me.TreeView1)
End Sub

Public Sub BuildTree(tvw As TreeView)

Dim nd As Node, pkey As String, _
    key As String, text As String, _
    cn As New ADODB.Connection, _
    rs As New ADODB.Recordset, SQL As String
cn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;" & _
                      "Data Source=Nama_Dsn;Initial Catalog=Nama_Database"
cn.Open
For i = 1 To 5
    key = "Nama Customer " & i
    text = key
    Set nd = tvw.Nodes.Add(, , key, text)
Next
For i = 1 To 5
    pkey = "Nama Customer " & i
    key = "Nama Barang " & i
    text = key
    Set nd = tvw.Nodes.Add(pkey, tvwChild, key, text)
Next
For i = 1 To 5
    pkey = "Nama Barang " & i
    key = "c" & i
    text = key
    Set nd = tvw.Nodes.Add(pkey, tvwChild, key, text)
Next

key = "Nama Customer Ambil Dari SQL Server"
text = key
Set nd = tvw.Nodes.Add(, , key, text)
'---
pkey = "Nama Customer Ambil Dari SQL Server"
key = "Daftar"
text = key
Set nd = tvw.Nodes.Add(pkey, tvwChild, key, text)


pkey = key

SQL = "SELECT * FROM Nama_Table"
rs.Open SQL, cn, adOpenKeyset, adLockBatchOptimistic

For i = 1 To rs.RecordCount
    Set nd = tvw.Nodes.Add(pkey, tvwChild, rs!Nama_Field & i, rs!Nama_Field)
    rs.MoveNext
Next i
End Sub

  ----- Original Message -----
  From: Zulfikar Vcar
  To: [email protected]
  Sent: Tuesday, May 02, 2006 11:58 AM
  Subject: [indoprog-vb] TREEVIEW


  Hallo VB Mania, ada yang punya contoh source code
  cara membuat informasi dengan komponen TREEVIEW,
  dimana data2 nya diambil dari database SQL
  Server......sbg contoh nama supplier sbg parent, n
  ketika folder supplier diklik keluar nama
  barangnya...... Saya butuh banget
  nichhhhhhhhhh...please help me............
  thank......

  __________________________________________________
  Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam protection around
  http://mail.yahoo.com


  Untuk berhenti berlangganan kirim email kosong ke : [EMAIL PROTECTED]

  Forum ini berkembang dengan pesat, jika anda memiliki
  dedikasi dan waktu, silahkan mengaplikasikan diri
  menjadi moderator.



  SPONSORED LINKS Computer internet security  Computer internet business  Computer internet access 
        Computer internet privacy securities  Computer internet help  Computer internet connection 


------------------------------------------------------------------------------
  YAHOO! GROUPS LINKS

    a..  Visit your group "indoprog-vb" on the web.
     
    b..  To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]
     
    c..  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


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




[Non-text portions of this message have been removed]



Untuk berhenti berlangganan kirim email kosong ke : [EMAIL PROTECTED]

Forum ini berkembang dengan pesat, jika anda memiliki
dedikasi dan waktu, silahkan mengaplikasikan diri
menjadi moderator.




SPONSORED LINKS
Computer internet security Computer internet business Computer internet access
Computer internet privacy securities Computer internet help Computer internet connection


YAHOO! GROUPS LINKS




Kirim email ke