-
May 17th, 2010, 03:01 AM
#1
Thread Starter
Member
[RESOLVED] Populate unbound Combobox w. Valuemember
Hi all, I've been away for a while from VB6 and just beginning with VB.NET 2008.
What I'm just trying to do is the following:
I need to fill a combobox from a dataset, but I have to translate the entries before displaying them. That's why I assume I have to use a loop to add the Items.
Yet if I simply use "comboBox.Items.Add()" then I can't set something like a ValueMember to store the ID.
Any ideas how to accomplish this?
-
May 17th, 2010, 03:26 AM
#2
Re: Populate unbound Combobox w. Valuemember
Just do a loop and interact with all datarow's in the datatable that you want to change, after this just set the combo box datasource to the datatable, and set the value member and the display member...
vb.net Code:
For Each r As DataRow In DataTable1.rows
r("col1") = "NewValue"
r("col2") = "NewValue"
Next
Rate People That Helped You
Mark Thread Resolved When Resolved
-
May 17th, 2010, 04:42 AM
#3
Thread Starter
Member
Re: Populate unbound Combobox w. Valuemember
Thanks, mickey!
How easy can it get? I got stuck into some complicated idea and did not think about that approach!
Tags for this Thread
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
|