|
-
Dec 21st, 2009, 04:14 PM
#1
Thread Starter
Addicted Member
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!
-
Dec 21st, 2009, 04:21 PM
#2
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:
ComboBox1.DataSource = Table ComboBox1.DisplayMember = "DateColumn" 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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|