Click here to Skip to main content
16,008,183 members
Home / Discussions / C#
   

C#

 
AnswerNot really the place for this question Pin
Pete O'Hanlon6-Feb-09 11:26
mvePete O'Hanlon6-Feb-09 11:26 
GeneralRe: Not really the place for this question Pin
MacSpudster9-Feb-09 8:34
professionalMacSpudster9-Feb-09 8:34 
Questiongenerating a class from an xsd at runtime? Pin
orinoco776-Feb-09 5:52
orinoco776-Feb-09 5:52 
AnswerRe: generating a class from an xsd at runtime? Pin
Ennis Ray Lynch, Jr.6-Feb-09 7:17
Ennis Ray Lynch, Jr.6-Feb-09 7:17 
QuestionReading the Caption(Title) of another Window Pin
SimpleData6-Feb-09 5:26
SimpleData6-Feb-09 5:26 
AnswerRe: Reading the Caption(Title) of another Window Pin
0x3c06-Feb-09 5:34
0x3c06-Feb-09 5:34 
AnswerRe: Reading the Caption(Title) of another Window Pin
Giorgi Dalakishvili6-Feb-09 5:48
mentorGiorgi Dalakishvili6-Feb-09 5:48 
QuestionGet SelectedListViewItemCollection threadsafe [modified] Pin
Tobesucht6-Feb-09 4:07
Tobesucht6-Feb-09 4:07 
Hi folks,

i´m trying to get a SelectedListViewItemCollection threadsafe, because i´m using it in a method which is called from another thread (FileSystemWatcher_Created).

I have tried to get the collection using a delegate function, but it won´t work fine.

Here is the code:


private void FuelleUnitsAuto()
 {
      Invoke(new clearListViewDelegate(BeginUpdateListView), new object[] { lV_Einheiten });
      Invoke(new beginUpdateListViewDelegate(ClearListView), new object[] { lV_Einheiten });

      ListView.SelectedListViewItemCollection coll = (ListView.SelectedListViewItemCollection)Invoke (new selectedListViewItemsDelegate(SelectedListViewItems), new object[] { lV_Num });
            

            //Here it fails with error INVALIDOPERATIONEXCEPTION
            foreach (cEinsatzListViewItem i in coll)
            {
                //do something
            }

      Invoke(new endUpdateListViewDelegate(EndUpdateListView), new object[] { lV_Einheiten });
}

private delegate ListView.SelectedListViewItemCollection selectedListViewItemsDelegate(ListView view);

private ListView.SelectedListViewItemCollection SelectedListViewItems(ListView view)
{
    return view.SelectedItems;
}

Anyone knows this error and can help?

Thanks a lot in advance,

Tobe

modified on Friday, February 6, 2009 10:22 AM

AnswerRe: Get SelectedListViewItemCollection threadsafe Pin
Tobesucht8-Feb-09 21:11
Tobesucht8-Feb-09 21:11 
QuestionSystem.Data.SqlClient.SqlClientpermission,System, publickey token='......' failed exception Pin
praveenvkumarv6-Feb-09 3:53
praveenvkumarv6-Feb-09 3:53 
AnswerCP: REPOST Pin
EliottA6-Feb-09 4:14
EliottA6-Feb-09 4:14 
GeneralRe: CP: REPOST Pin
musefan6-Feb-09 4:30
musefan6-Feb-09 4:30 
QuestionRefreshing Datagrid/BindingSource Pin
Muammar©6-Feb-09 3:44
Muammar©6-Feb-09 3:44 
AnswerRe: Refreshing Datagrid/BindingSource Pin
Lodeclaw6-Feb-09 5:36
Lodeclaw6-Feb-09 5:36 
AnswerRe: Refreshing Datagrid/BindingSource Pin
howlettt6-Feb-09 6:03
howlettt6-Feb-09 6:03 
GeneralRe: Refreshing Datagrid/BindingSource Pin
Muammar©6-Feb-09 18:55
Muammar©6-Feb-09 18:55 
GeneralRe: Refreshing Datagrid/BindingSource [modified] Pin
howlettt7-Feb-09 6:03
howlettt7-Feb-09 6:03 
GeneralRe: Refreshing Datagrid/BindingSource Pin
Muammar©7-Feb-09 18:57
Muammar©7-Feb-09 18:57 
Questionproblem in C# Pin
raju00036-Feb-09 3:39
raju00036-Feb-09 3:39 
AnswerRe: problem in C# Pin
Guffa6-Feb-09 5:46
Guffa6-Feb-09 5:46 
QuestionWindows Application Pin
mrithula86-Feb-09 3:35
mrithula86-Feb-09 3:35 
AnswerRe: Windows Application Pin
musefan6-Feb-09 3:46
musefan6-Feb-09 3:46 
AnswerRe: Windows Application Pin
vaghelabhavesh6-Feb-09 4:06
vaghelabhavesh6-Feb-09 4:06 
AnswerRe: Windows Application Pin
harold aptroot6-Feb-09 4:27
harold aptroot6-Feb-09 4:27 
QuestionHide password decryption Pin
William Engberts6-Feb-09 3:14
William Engberts6-Feb-09 3:14 

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.