?
Solved

Checked listbox, dont get the database values inside the listbox

Posted on 2007-11-15
8
Medium Priority
?
663 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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 …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

764 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