Referring linked cells in differrent worksheet

Hi

How can i link a cell of Listbox control in sheet1 at position B3, a cell in Sheet2 at position B3.

How do we do multiselect list box linked cells

Regards

Shalini

Hi,

For making a multiselect list box you may use:

listbox.SelectionType = SelectionType.Multi;

And if you make a multiselect listbox, you cannot refer it to a linked cell. This functionality is same as Ms Excel.

For getting the selected cells's values, you may try to consult the followng code:

//Here lst is the ListBox object

Cell[] selectedCells = lst.SelectedCells;

for (int i = 0; i < selectedCells.Length; i++)

{

MessageBox.Show(selectedCells[i].Value.ToString());

}

And you may use SelectedItem and IsSelected members for your need as well to dynamically select your desired items and check whether a specified item is selected or not.

//Select the second item.

lst.SelectedItem(1, true);

//Select the 6th item (last item)

lst.SelectedItem(5,true);

bool check5 = lst.IsSelected(5);

.

.

Thank you.