Click here to Skip to main content
15,878,852 members
Home / Discussions / C#
   

C#

 
QuestionProblem with deleting a row from a sorted DataGrid Pin
Larantz25-Apr-06 2:30
Larantz25-Apr-06 2:30 
AnswerRe: Problem with deleting a row from a sorted DataGrid Pin
Robert Rohde25-Apr-06 3:29
Robert Rohde25-Apr-06 3:29 
QuestionChange active database in runtime Pin
siliconesoul25-Apr-06 2:29
siliconesoul25-Apr-06 2:29 
AnswerRe: Change active database in runtime Pin
Le centriste25-Apr-06 3:43
Le centriste25-Apr-06 3:43 
GeneralRe: Change active database in runtime Pin
siliconesoul25-Apr-06 8:19
siliconesoul25-Apr-06 8:19 
GeneralRe: Change active database in runtime Pin
Le centriste25-Apr-06 9:13
Le centriste25-Apr-06 9:13 
Questionimage rotation with link Pin
Amalarajan25-Apr-06 2:20
Amalarajan25-Apr-06 2:20 
QuestionDelegate .Invoke method problem Pin
danchester25-Apr-06 2:14
danchester25-Apr-06 2:14 
I have the following code which updates a tree view when called. For some reason beyond me, the second time it is called (foreach (Contact c in contacts) is previously called, so this is invoked for each new addition to the treeview), it produces a NullReferenceException unhandled error.

public void UpdateContactGroup(Contact contactIn)<br />
        {<br />
            if (this.trvContacts.InvokeRequired)<br />
            {<br />
                UpdateContactGroupCallBack d = new UpdateContactGroupCallBack(UpdateContactGroup);<br />
                this.Invoke(d, new object[] { contactIn });<br />
            }<br />
            else<br />
            {<br />
                TreeNode newNode; <br />
                if (!trvContacts.Nodes.Contains(new TreeNode(contactIn.Group)))<br />
                {<br />
                    //if doesn't contain, then add new group node<br />
                    newNode = new TreeNode(contactIn.Group );<br />
                    //newNode.ImageIndex = 1;<br />
                    trvContacts.Nodes.Add(newNode);<br />
                }<br />
                //add user to group<br />
                newNode = new TreeNode(contactIn.Username);<br />
                //newNode.ImageIndex = 2;<br />
                trvContacts.Nodes[contactIn.Group].Nodes.Add(newNode);<br />
            }<br />
        }


Also, when hovering over the error in debugging mode, all the fields are shown to be present.


Another method using the invoke called updating a rich text box works fine all the time.
Can anyone tell me what I'm doing wrong?
Questionintegration Collection Pin
ashishnagar125-Apr-06 2:04
ashishnagar125-Apr-06 2:04 
QuestionGenerate rdlc file dynamically Pin
Bobby88725-Apr-06 1:29
Bobby88725-Apr-06 1:29 
QuestionSystem tray icon Pin
VanEtienne25-Apr-06 1:27
VanEtienne25-Apr-06 1:27 
AnswerRe: System tray icon Pin
CWIZO25-Apr-06 2:30
CWIZO25-Apr-06 2:30 
AnswerRe: System tray icon Pin
Aaron Dilliard25-Apr-06 3:57
Aaron Dilliard25-Apr-06 3:57 
AnswerRe: System tray icon Pin
Graham Nimbley25-Apr-06 9:39
Graham Nimbley25-Apr-06 9:39 
QuestionWindows based Querry Pin
meer_Lx25-Apr-06 1:24
meer_Lx25-Apr-06 1:24 
AnswerRe: Windows based Querry Pin
Guffa25-Apr-06 1:30
Guffa25-Apr-06 1:30 
GeneralRe: Windows based Querry Pin
meer_Lx25-Apr-06 20:24
meer_Lx25-Apr-06 20:24 
AnswerRe: Windows based Querry Pin
Guffa26-Apr-06 1:52
Guffa26-Apr-06 1:52 
AnswerRe: Windows based Querry Pin
alexey N25-Apr-06 1:31
alexey N25-Apr-06 1:31 
QuestionWorkig with Visual Studio 2005 Command Prompt programatically. Pin
vikram abrol25-Apr-06 0:41
vikram abrol25-Apr-06 0:41 
AnswerRe: Workig with Visual Studio 2005 Command Prompt programatically. Pin
alexey N25-Apr-06 0:51
alexey N25-Apr-06 0:51 
GeneralRe: Workig with Visual Studio 2005 Command Prompt programatically. Pin
vikram abrol25-Apr-06 2:08
vikram abrol25-Apr-06 2:08 
GeneralRe: Workig with Visual Studio 2005 Command Prompt programatically. Pin
alexey N25-Apr-06 17:28
alexey N25-Apr-06 17:28 
AnswerRe: Workig with Visual Studio 2005 Command Prompt programatically. Pin
Mikhail Gorbachev25-Apr-06 2:40
Mikhail Gorbachev25-Apr-06 2:40 
QuestionWebServiceAccessor Problem Pin
Ronakkhanoom25-Apr-06 0:10
Ronakkhanoom25-Apr-06 0:10 

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.