Results 1 to 2 of 2

Thread: Database problem

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2009
    Posts
    138

    Database problem

    I have one Access Database and I want to fill one list box with dates from the Database. So, I made DataSet, BindingSource and Table Adapter. I made one label and put it on my form and set it's DataBindings (Text) property from Properties box on BindingSource.Date

    And I want to fill list box with dates from one row from Access.

    I'm using the following code:

    Code:
            Me.TableAdapter.Fill(Me.DataSet.Table)
            Me.BindingSource.MoveFirst()
            Dim lista As Integer
            For lista = 1 To BindingSource.Count
                ComboBox1.Items.Add(Label1.Text)
            BindingSource.Position += 1
            Next
    And when I have 1,2,3,4,5,6,7,8,9,10 in Access everything is OK, but when I have for example numbers till 100 (hundred) program bamboozle. So, this is what it writes in ListBox when I have numbers from 1 to 100 in Access Database. It writes first 46-100 and then after this 1-45. I believe you understand me. What's the problem? Thanks!

  2. #2
    Frenzied Member mickey_pt's Avatar
    Join Date
    Sep 2006
    Location
    Corner of the Europe :)
    Posts
    1,959

    Re: Database problem

    Why do you need the binding source and the loop?!

    Just set the combobox datasource to point your table, and the display member to the name of the column that have the dates..

    Example:
    vb.net Code:
    1. ComboBox1.DataSource = Table
    2. ComboBox1.DisplayMember = "DateColumn"
    3. ComboBox1.ValueMember = "DateColumn"

    Rate People That Helped You
    Mark Thread Resolved When Resolved

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