Results 1 to 4 of 4

Thread: [Resolved] Add one line of text to combo box after binding to dataset

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    [Resolved] Add one line of text to combo box after binding to dataset

    I have the following code which binds the combo box to a dataset.
    VB Code:
    1. Dim cn As New SqlClient.SqlConnection()
    2.         Dim da As SqlClient.SqlDataAdapter
    3.         Dim ds As New DataSet()
    4.  
    5.         cn.ConnectionString = "Integrated Security=True;" & _
    6.         "Data Source=Brutus;Initial Catalog=Problem Tracking;" & _
    7.         "user id=user;password=pass;"
    8.         cn.Open()
    9.  
    10.         da = New SqlClient.SqlDataAdapter("Select [Store Number] From Stores Order " & _
    11.         "By [Store Number]", cn)
    12.         da.Fill(ds, "Stores")
    13.  
    14.         cmbStores.Items.Clear()
    15.  
    16.         cmbStores.DataSource = ds.Tables("Stores")
    17.         cmbStores.DisplayMember = "Store Number"
    At the top of this list in this combo box, I would like to add "All"

    I tried this to no avail.
    VB Code:
    1. cmbStores.Items.Insert("All", 0)
    I received an error about the combo box being set.

    Anyone have any ideas?

    Thanks!
    Last edited by indydavid32; Dec 10th, 2003 at 08:45 AM.
    David Wilhelm

Posting Permissions

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



Click Here to Expand Forum to Full Width