Solved

Checked listbox, dont get the database values inside the listbox

Posted on 2007-11-15
8
661 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 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