hii,

i m developing an application n i am using the list box control. i hv allowed that multiple items can be selected.

now what i want when the user selects a particular item , a popup or any control should open that allow user to enter the amont related to that selected item.

like for single slelcted item i can use the texbox and the ok button.

when the user selects the 2 nd item , then hw the button and textbox of the previos selection shud be effected:

1. if i dont not put values in the textbox for the first selection.then hw shud it be made visible but if i select the 2 nd value in the textbox then some popup shud be there to get the value and hw the initail popup shud be made visible.

it is like new implementation

if somebody has any idea hw it shud be done plz explain.

ex.

1st item attached to some textbox and button.

2nd item attched to some textbox and button

....................n th item atttached to some textbox and button.

listbox is allowed with multiple selection.

how shud i do it???

This is going off my best guess of what you are trying to accomplish so feel free to correct me on any details I get wrong.

I'd recommend using the OnSelectedIndexChange event to capture the selection of each box.
You could then use the event to display whichever fields you deem necessary based on the selected items of the list.

for(int i=0;i< ListBox1.Items.Count ;i++)
        {
            if (ListBox1.Items[i].Selected == true)
            {
                array[i] = ListBox1.Items[i].ToString(); 
            }
        }

i m planniong to get the values like this.
but if i want to store the values in a table along wid the indez.
shud i use two dimensional array and can u provide me the more bit of code to accomplish my task?

That's not a bad way to gather the values. It's a little confusing though, that would only grab the text displayed beside each checkbox on the list. Before you mentioned that you wanted to have a textbox that would allow for quantity information with each item.

An index value wouldn't be that difficult, you can use the value property of the listbox.item to store the value you need.

I'll need a little clarification to provide you with code, are you trying to store the values in a database table or an in memory table? What you want to do with the data once you've collected it? That will help decide how you work with it.
Also what is causing this loop to execute?

This article has been dead for over six months. Start a new discussion instead.