Click here to Skip to main content
16,005,467 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# Code Help Pin
Pedram Behroozi15-Oct-08 5:54
Pedram Behroozi15-Oct-08 5:54 
GeneralRe: C# Code Help Pin
boiDev15-Oct-08 6:57
boiDev15-Oct-08 6:57 
AnswerLET ME DROP EVERYTHING AND WORK ON YOUR PROBLEM Pin
Le centriste15-Oct-08 6:26
Le centriste15-Oct-08 6:26 
GeneralRe: LET ME DROP EVERYTHING AND WORK ON YOUR PROBLEM Pin
boiDev15-Oct-08 6:28
boiDev15-Oct-08 6:28 
GeneralRe: LET ME DROP EVERYTHING AND WORK ON YOUR PROBLEM Pin
Le centriste15-Oct-08 6:29
Le centriste15-Oct-08 6:29 
GeneralRe: LET ME DROP EVERYTHING AND WORK ON YOUR PROBLEM Pin
boiDev15-Oct-08 6:50
boiDev15-Oct-08 6:50 
JokeRe: C# Code Help Pin
nelsonpaixao15-Oct-08 14:00
nelsonpaixao15-Oct-08 14:00 
AnswerRe: C# Code Help Pin
Lea Hayes17-Oct-08 4:32
Lea Hayes17-Oct-08 4:32 
Okay...

Personally I would create some sort of a class which contains the data I want to access.

public class MyDataTag
{
    public MyDataTag(DataRowView dataRow)
    {
        itemID = dataRow["NodeId"];
        text = dataRow["EnNode"].ToString();
        otherInfo = dataRow["OtherInfo"].ToString();
    }

    public object itemID;
    public string text;
    public string otherInfo;
}


Then I would replace the tree node creation code with:

TreeNode node = new TreeNode();
MyDataTag dataTag = new MyDataTag(dv[i]);
node.Text = dataTag.text;
node.Tag = dataTag;


And your AfterSelect event handler:

MyDataNode itemData = e.Node.Tag as MyDataNode;
if (itemData != null)
{
    string test = string.Format("ID: {0}  Other Info: {1}", itemData.itemID.ToString(), itemData.otherInfo);
    ListViewItem newItem = listView1.Items.Add(test);
    newItem.Tag = itemData;
}

Smile | :)

Lea Hayes
GeneralRe: C# Code Help Pin
boiDev17-Oct-08 5:14
boiDev17-Oct-08 5:14 
QuestionC# Help Urgent Pin
boiDev15-Oct-08 5:13
boiDev15-Oct-08 5:13 
AnswerRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
Ashfield15-Oct-08 5:17
Ashfield15-Oct-08 5:17 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
boiDev15-Oct-08 5:19
boiDev15-Oct-08 5:19 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
J4amieC15-Oct-08 5:50
J4amieC15-Oct-08 5:50 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
Paul Conrad15-Oct-08 6:47
professionalPaul Conrad15-Oct-08 6:47 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
boiDev15-Oct-08 6:51
boiDev15-Oct-08 6:51 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
Paul Conrad15-Oct-08 6:53
professionalPaul Conrad15-Oct-08 6:53 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
boiDev15-Oct-08 6:56
boiDev15-Oct-08 6:56 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
Paul Conrad15-Oct-08 6:59
professionalPaul Conrad15-Oct-08 6:59 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
boiDev15-Oct-08 7:02
boiDev15-Oct-08 7:02 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
Dave Kreskowiak15-Oct-08 7:10
mveDave Kreskowiak15-Oct-08 7:10 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
boiDev15-Oct-08 7:17
boiDev15-Oct-08 7:17 
GeneralRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
Ashfield15-Oct-08 8:38
Ashfield15-Oct-08 8:38 
JokeRe: C# Help Urgent - OH NO ITS NOT!!!!!!!!!!!!!!! Pin
Giorgi Dalakishvili15-Oct-08 7:01
mentorGiorgi Dalakishvili15-Oct-08 7:01 
JokeRe: C# Help Urgent Pin
nelsonpaixao15-Oct-08 14:27
nelsonpaixao15-Oct-08 14:27 
QuestionPlease Help Me C# Pin
boiDev15-Oct-08 4:57
boiDev15-Oct-08 4:57 

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.