Solved

The data to checked listbox is not correct

Posted on 2007-11-14
14
187 Views
Last Modified: 2010-04-23
       CheckedListBox1.DataSource = Me.BindingSource1

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


When starting the program all i get from 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
  • 7
  • 5
14 Comments
 
LVL 8

Expert Comment

by:Chumad
ID: 20282720
You need to also define the fields where the data comes from...

CheckedListBox1.DataTextField = "someField";
CheckedListBox1.DataValueField = "someotherField";
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20282738
uhm, im sorry, i dont quite understand that one, what should i use in the "someField" ?
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20282749
also, datatextfield is not a member of the checklistbox1 i get a error saying in visual studio, so i cant use the datatextfield or the datavaluefield
0
 
LVL 8

Expert Comment

by:Chumad
ID: 20282765
Well, for DataTextField, that's what the user sees - the value in the list box. This needs to point to some field or property in DataSet1. Here, I'm going to assume you need to use "ITM_TYPEColumn"

CheckedListBox1.DataTextField = "ITM_TYPEColumn";

Likewise, DataValueField is going to point to the property/field in DataSet1 that contains the value - usually a primary key. You can probably use the same value here if you want "ITM_TYPEColumn"
0
 
LVL 8

Expert Comment

by:Chumad
ID: 20282772
Try using DisplayMember instead:

CheckedListBox1.DisplayMember = "ITM_TYPEColumn";
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20282803
ok thanks, but i cant use checkedlistbox1.datatextfield, becouse of this error:

'datatextfield' is not a member of system.windows.forms.checkedlistbox

this error is the same for the checkedlistbox1.datavaluefield

0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 8

Expert Comment

by:Chumad
ID: 20282824
ok, I wasn't aware you were doing windows forms (vs web forms). Try this way:

CheckedListBox1.DisplayMember = "ITM_TYPEColumn"
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20282861
oki, well i tried it and i got the same result, is this code supposed to be instead of the .displaymember i already have in my code, or should i add it under my code?

I tried removing my version of the display member, and adding your version, but i got same result. i tried with just yours but i still got same, anything im doing wrong?
0
 
LVL 8

Expert Comment

by:Chumad
ID: 20282891
Can you paste all your modified code in here (the version that has the suggested changes)?
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20283089
CheckedListBox1.DataSource = Me.BindingSource1

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

then i add your part of the code

CheckedListBox1.DisplayMember = "ITM_TYPEColumn"

ive also tried removing the CheckedListBox1.DisplayMember = Me.DataSet1.ITEM.ITM_TYPEColumn.ToString()

without any luck
0
 
LVL 3

Accepted Solution

by:
leeds2000 earned 0 total points
ID: 20337175
The error was that i hadnt added a tableadapter to my form :/
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20365436
And my code worked as soon as i added this tableadapter, so always check if you have a tableadapter in visual studio 2005 if you cant get any data as soon as your form loads :)
0
 
LVL 1

Expert Comment

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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now