Click here to Skip to main content
15,885,876 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to use Syste,.data.common.DbConnection variable ? Pin
Vasudevan Deepak Kumar21-Aug-07 23:40
Vasudevan Deepak Kumar21-Aug-07 23:40 
AnswerRe: How to use Syste,.data.common.DbConnection variable ? Pin
Nissim Salomon21-Aug-07 21:56
Nissim Salomon21-Aug-07 21:56 
AnswerRe: How to use Syste,.data.common.DbConnection variable ? Pin
nicolus21-Aug-07 22:19
nicolus21-Aug-07 22:19 
QuestionListbox control Pin
Ankit Aneja21-Aug-07 21:20
Ankit Aneja21-Aug-07 21:20 
AnswerRe: Listbox control Pin
Giorgi Dalakishvili21-Aug-07 22:01
mentorGiorgi Dalakishvili21-Aug-07 22:01 
GeneralRe: Listbox control Pin
Ankit Aneja21-Aug-07 23:51
Ankit Aneja21-Aug-07 23:51 
GeneralRe: Listbox control Pin
Giorgi Dalakishvili22-Aug-07 0:02
mentorGiorgi Dalakishvili22-Aug-07 0:02 
AnswerRe: Listbox control Pin
Hessam Jalali21-Aug-07 22:09
Hessam Jalali21-Aug-07 22:09 
Generally You can use this.listBox1.SelectedItems orthis.listBox1.SelectedIndices properties for retrieving selected items

one of the solutions would be check the collection from SelectedIndeices property to see wether your desired indices are selected or not

System.Windows.Forms.ListBox.SelectedIndexCollection indices  = this.listBox1.SelectedIndices;

if (indices.Contains(0) && indices.Contains(3) && indices.Contains(6))
    //are selected


but more alghoritmic way is
bool CheckIsSelected(int[] desiredIndices)
{
    System.Windows.Forms.ListBox.SelectedIndexCollection indices = this.listBox1.SelectedIndices;

    bool selected = true;

    foreach (int index in desiredIndices)
        if (!indices.Contains(index))
        {
            selected = false;
            break;
        }

    if (selected) return true;
    return false;
}



good luck
GeneralRe: Listbox control Pin
Ankit Aneja22-Aug-07 0:53
Ankit Aneja22-Aug-07 0:53 
GeneralRe: Listbox control Pin
Hessam Jalali22-Aug-07 1:12
Hessam Jalali22-Aug-07 1:12 
GeneralRe: Listbox control Pin
Hessam Jalali22-Aug-07 1:17
Hessam Jalali22-Aug-07 1:17 
QuestionIdentifying file is in use Pin
N a v a n e e t h21-Aug-07 21:16
N a v a n e e t h21-Aug-07 21:16 
AnswerRe: Identifying file is in use Pin
Giorgi Dalakishvili21-Aug-07 22:03
mentorGiorgi Dalakishvili21-Aug-07 22:03 
GeneralRe: Identifying file is in use Pin
Martin#21-Aug-07 22:24
Martin#21-Aug-07 22:24 
GeneralRe: Identifying file is in use Pin
Giorgi Dalakishvili21-Aug-07 22:26
mentorGiorgi Dalakishvili21-Aug-07 22:26 
GeneralRe: Identifying file is in use Pin
Martin#21-Aug-07 22:33
Martin#21-Aug-07 22:33 
GeneralRe: Identifying file is in use Pin
N a v a n e e t h21-Aug-07 22:48
N a v a n e e t h21-Aug-07 22:48 
GeneralRe: Identifying file is in use Pin
N a v a n e e t h21-Aug-07 22:50
N a v a n e e t h21-Aug-07 22:50 
Question"handling" an event on controls Pin
cignox121-Aug-07 20:58
cignox121-Aug-07 20:58 
AnswerRe: "handling" an event on controls Pin
Martin#21-Aug-07 22:09
Martin#21-Aug-07 22:09 
GeneralRe: "handling" an event on controls Pin
cignox122-Aug-07 0:22
cignox122-Aug-07 0:22 
GeneralRe: "handling" an event on controls Pin
Martin#22-Aug-07 1:16
Martin#22-Aug-07 1:16 
QuestionSoftware Licening.. Pin
Rahul.RK21-Aug-07 20:40
Rahul.RK21-Aug-07 20:40 
AnswerRe: Software Licening.. Pin
Nouman Bhatti21-Aug-07 21:00
Nouman Bhatti21-Aug-07 21:00 
AnswerRe: Software Licening.. Pin
Mark Churchill21-Aug-07 21:18
Mark Churchill21-Aug-07 21:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.