Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Checked listbox, dont get the database values inside the listbox

Posted on 2007-11-15
8
Medium Priority
?
665 Views
Last Modified: 2012-05-05
CheckedListBox1.DataSource = Me.BindingSource1

        CheckedListBox1.DisplayMember = Me.DataSet1.ITEM.ITM_TYPEColumn.ToString()


I have created the Bindingsource and dataset1 using visual studio 2005 tools, no hardcoding. I dont know how to hardcode this into my code.

When starting the program all i get inside the checked listbox is system.data.DataViewManagerListItemTypeDescriptor

Im connecting to a oracle database, and i dont understand why i dont get the Item types in the checked listbox when i start program :/

Please help!!
0
Comment
Question by:leeds2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 2

Expert Comment

by:smcdrc
ID: 20292179
CheckedListBox1.DataTextField = "ColumnName"
 CheckedListBox1.DataValueField = "ColumnName"

Replace column name with the names of the columns you want displayed in the checked listbox.
0
 
LVL 2

Expert Comment

by:smcdrc
ID: 20292188
Basically, you need to tell it what columns to use.
0
 
LVL 18

Expert Comment

by:vbturbo
ID: 20292226
try this

       With CheckedListBox1

                .DisplayMember = "ITM_TYPEColumn"
                .ValueMember = "ITM_TYPEColumn"
                .DataSource = DataSet1.Tables("ITEM")

     End With

vbturbo
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:leeds2000
ID: 20292548
ok the error seemed to be that my form didnt have a tableadapter to it. I got this to show up when added a datagrid view and just deleted it after.

The code i had worked fine too :)

But then another question you might know

i need two lines in the checkedlistbox, like "Customer_first name" and on the same line in the checkbox "customer_lastname"

how can i do this?

ive tried to CheckedListBox1.DisplayMember = Me.DataSet1.ITEM.ITM_TYPEColumn.ToString() & Me.DataSet1.ITEM.ITM_TYPEColumn.ToString()

without any luck, then the "error system.data.DataRowView" appears inside the checkbox when trying this

0
 
LVL 2

Expert Comment

by:smcdrc
ID: 20297870
The easiest way I have found to do this is in the query/stored Proc.  For example:
Select Name, Company, Name + '-'+Company and Name_Company...

0
 
LVL 3

Accepted Solution

by:
leeds2000 earned 0 total points
ID: 20297969
i resolved it by using        


Dim drv As DataRow
Dim rows As DataRowCollection = Dataset.customer.Rows

        For Each drv In rows
            Me.checklistbox.Items.Add(drv(2).ToString() + " " + drv(1).ToString() + " " + drv(3).ToString())
        Next

0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20349797
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question