|
|||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionDue to the fact that .NET ApproachWe have to implement four extra properties:
You already know the use of the first three but the last one is a Using the CodeTo use this code, you have to create an object whose type is cCheckedListBox cbGenreList = new cCheckedListBox();
cbGenreList.Location = new Point(8, 20);
cbGenreList.Size = new Size(130, 180);
this.grpGenres.Controls.Add(cbGenreList);
// Let's bind it to data from a Database
var GenreList = from c in databasebObjectContext.Genres orderby c.gnDescription select c;
cbGenreList.DataSource = GenreList.ToArray();
cbGenreList.DisplayMember = "gnDescription";
cbGenreList.ValueMember = "gnNumber";
To retrieve the values of the checked items : List <int> selectedValues;
selectedValues= cbGenreList.ValueList;
To check some items by ID: List<int> myValues = new List<int>();
myValues.Add(44);
myValues.Add(45);
myValues.Add(46);
cbGenreList.ValueList = myValues;
History
|
||||||||||||||||||||||||||||||||||||||||