Click here to Skip to main content
15,564,935 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to write Context menu helper class Pin
Rob Philpott26-Aug-14 23:38
Rob Philpott26-Aug-14 23:38 
GeneralRe: How to write Context menu helper class Pin
Tejas Vaishnav27-Aug-14 0:00
professionalTejas Vaishnav27-Aug-14 0:00 
GeneralRe: How to write Context menu helper class Pin
Eddy Vluggen27-Aug-14 1:28
professionalEddy Vluggen27-Aug-14 1:28 
AnswerRe: How to write Context menu helper class Pin
Tejas Vaishnav27-Aug-14 2:26
professionalTejas Vaishnav27-Aug-14 2:26 
GeneralRe: How to write Context menu helper class Pin
Eddy Vluggen27-Aug-14 9:12
professionalEddy Vluggen27-Aug-14 9:12 
Questionc# XML nodelist to datagrid Pin
jdpiper6526-Aug-14 12:44
jdpiper6526-Aug-14 12:44 
AnswerRe: c# XML nodelist to datagrid Pin
Bernhard Hiller26-Aug-14 21:55
Bernhard Hiller26-Aug-14 21:55 
GeneralRe: c# XML nodelist to datagrid Pin
jdpiper6527-Aug-14 5:58
jdpiper6527-Aug-14 5:58 
I apologize. Let me try an explain further. I need to split the Operation Element innertext which is being done. The issue is trying to get that text into the datatable row properly. I have modified the function some to add columns as I know what those are going to be. It is the childnode values that change and I need to take Operation childnode and change the loop to add the OpCode and Description strings rather than the Operation childnode innertext.
        public static DataTable ConvertXmlNodeListToDataTable(XmlNodeList xnl)
        {
            DataTable dt = new DataTable();
            string strOpCode, strDescription; //set code vars
            dt.Columns.Add("RecordID");
            dt.Columns.Add("SWR");
            dt.Columns.Add("OpCode");
            dt.Columns.Add("Description");
            dt.Columns.Add("PartsAmount");
            dt.Columns.Add("LaborAmount");

            int ColumnsCount = dt.Columns.Count;
            for (int i = 0; i < xnl.Count; i++)
            {
                DataRow dr = dt.NewRow();

                for (int j = 0; j < ColumnsCount; j++)
                {
                    if (xnl.Item(i).ChildNodes[j].Name == "Operation")
                    {
                        CodesDesc(xnl.Item(i).ChildNodes[j].InnerText, out strOpCode, out strDescription);
                        dr[j] = strOpCode.ToString();
                        dr[j+1] = strDescription.ToString();
                        j++;
                    }
                    else
                    {
                        dr[j] = xnl.Item(i).ChildNodes[j].InnerText;
                    }
                }
                dt.Rows.Add(dr);
            }
            return dt;
        }        
Does this help clear things up? I amnot able to insert the text into the datarow properly during the  for loop which is where my headaches are coming from..


modified 27-Aug-14 14:44pm.

Questionscraping C# Pin
jojoba2026-Aug-14 11:23
jojoba2026-Aug-14 11:23 
AnswerRe: scraping C# Pin
Dave Kreskowiak26-Aug-14 13:13
mveDave Kreskowiak26-Aug-14 13:13 
SuggestionRe: scraping C# Pin
jojoba2027-Aug-14 7:59
jojoba2027-Aug-14 7:59 
QuestionObject Reference Error Pin
Member 914293626-Aug-14 8:29
Member 914293626-Aug-14 8:29 
AnswerRe: Object Reference Error Pin
OriginalGriff26-Aug-14 9:17
mvaOriginalGriff26-Aug-14 9:17 
GeneralRe: Object Reference Error Pin
Member 914293626-Aug-14 20:17
Member 914293626-Aug-14 20:17 
AnswerRe: Object Reference Error Pin
Richard Deeming26-Aug-14 10:21
mveRichard Deeming26-Aug-14 10:21 
GeneralRe: Object Reference Error Pin
Member 914293626-Aug-14 20:02
Member 914293626-Aug-14 20:02 
GeneralRe: Object Reference Error Pin
Bernhard Hiller26-Aug-14 22:05
Bernhard Hiller26-Aug-14 22:05 
QuestionSpeech recogination of specific language Pin
frech8726-Aug-14 2:16
frech8726-Aug-14 2:16 
AnswerRe: Speech recogination of specific language Pin
Pete O'Hanlon26-Aug-14 2:44
mvaPete O'Hanlon26-Aug-14 2:44 
GeneralRe: Speech recogination of specific language Pin
frech8726-Aug-14 2:48
frech8726-Aug-14 2:48 
GeneralRe: Speech recogination of specific language Pin
ZurdoDev26-Aug-14 2:56
professionalZurdoDev26-Aug-14 2:56 
GeneralRe: Speech recogination of specific language Pin
GuyThiebaut26-Aug-14 4:40
professionalGuyThiebaut26-Aug-14 4:40 
GeneralRe: Speech recogination of specific language Pin
Pete O'Hanlon26-Aug-14 4:55
mvaPete O'Hanlon26-Aug-14 4:55 
GeneralRe: Speech recogination of specific language Pin
GuyThiebaut26-Aug-14 5:05
professionalGuyThiebaut26-Aug-14 5:05 
GeneralOT Pin
Keith Barrow26-Aug-14 5:34
professionalKeith Barrow26-Aug-14 5:34 

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.