Results 1 to 2 of 2

Thread: C# control

  1. #1
    Join Date
    Dec 2001
    Location
    Barcelona
    Posts
    32

    Question Unanswered: C# control

    I must to fill a combobox. My data source is an xml file. Wich is the better system to populate the combobox? I can do it with the traditional AddItem method, but I don't know if there is a better manner to do it. Thank you.

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138
    i've never done it pulling from an xml file, but from a database you can do something like

    Code:
    Dim conn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim sql As String
    
    set conn = "Driver={SQL SERVER};Server=myServer;Database=myDb;UID=me;PWD=****"
    
    set sql = "SELECT name FROM tableName"
    
    rs.Open(sql, conn, 3, 3)
    
    do until rs.eof
       cboCombobox.AddItem(rs!name)
       rs.movenext
    loop
    
    set rs = nothing
    set sql = nothing
    set conn = nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •