I was wondering if you can have a muli line ListBox with only 1 index for more than one line...
ie. Im working on a restaurant program and for one item i want to display on more than one line... and when you click on a item it highlights all the ones in that index...
small |\
ham | > these 3 lines i want for 1 index so if i want to delete a item it would delete all 3 lines...
pepp |/
-------------------------------------------------------------------------------------------------
medium | \
pepp | > these 4 lines i want for 1 index
mush | /
onion |/
Is there a way to do that with listbox's or a way to somehow code it to work like that????
................................................................................................................................
Well this is what i figured out
int
itemCount = 0 // Used for each item added to the list i.e 3 pizzas itemCount = 3List<
int> numberInEach = new List<int>(); // How many lines in each item // i.e pizza 1: MEDIUM // WORKS // pizza 2: LARGE // HAM // pizza 3: SMALL // GREEN PEPPERS // ONIONS // so array would have {2,2,3}int
index = listBox1.SelectedIndex; // find which item they pickedbool
isFound = false; // if item found than exit while loopint
findItem = 0; // counts the number of lines per itemint
count = 0; // used to go thought the numberInEach arrayWhile (isfound ==
false){
findItem += numberInEach[count];
// gets the number for each item and adds it to find the index range if (findItem < index) // checks to see if item is with-in indexisFound =
true; elsecount++;
}
for
(int number = numberInEach[count]; number > 0; number--){
findItem--;
listBox1.SetSelected(findItem, True);
// select each line the item is in}
Not the best way, i just thought there would be a better way of selecting multipul lines in one index is all
Vijaya KadiyalaPosted Mar 14, 2009, 8:26 AM
Hi
Check out the below link
http://www.codeproject.com/KB/combobox/nishmullinlisbox.aspx
Thanks -- Vijaya Kadiyala
http://dotnetvj.blogspot.com