Solved

Checked listbox, dont get the database values inside the listbox

Posted on 2007-11-15
8
662 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
Industry Leaders: 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

688 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