Click here to Skip to main content
15,881,870 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Setting a COM reference to a VB6 Project in C# Pin
Dave Kreskowiak1-Sep-11 3:36
mveDave Kreskowiak1-Sep-11 3:36 
GeneralRe: Setting a COM reference to a VB6 Project in C# Pin
chiselca2-Sep-11 9:03
chiselca2-Sep-11 9:03 
GeneralRe: Setting a COM reference to a VB6 Project in C# Pin
Dave Kreskowiak2-Sep-11 11:19
mveDave Kreskowiak2-Sep-11 11:19 
GeneralRe: Setting a COM reference to a VB6 Project in C# Pin
chiselca2-Sep-11 13:49
chiselca2-Sep-11 13:49 
QuestionXML to DataTable/DataGrid Pin
Anoop Brijmohun29-Aug-11 21:56
Anoop Brijmohun29-Aug-11 21:56 
QuestionRe: XML to DataTable/DataGrid Pin
Shahan Ayyub31-Aug-11 12:06
Shahan Ayyub31-Aug-11 12:06 
AnswerRe: XML to DataTable/DataGrid Pin
Anoop Brijmohun31-Aug-11 20:55
Anoop Brijmohun31-Aug-11 20:55 
AnswerRe: XML to DataTable/DataGrid Pin
Shahan Ayyub1-Sep-11 3:57
Shahan Ayyub1-Sep-11 3:57 
I have optimized the code a bit more, kindly check it out:

VB
Public Function XmlToDataTable(ByVal path As String) As DataTable
        Dim dt As New DataTable
        Dim doc As New XmlDocument()
        Dim PoNum As String = String.Empty
        Dim Header As String = String.Empty
        doc.Load(path)
        dt.Columns.Add("PoNum")
        dt.Columns.Add("Header")
        dt.Columns.Add("Line")
        dt.Columns.Add("Error")
        Dim cnt As Integer = doc.SelectNodes("Orders/OrderHeader").Count
        For k As Integer = 0 To cnt - 1  
            Dim node As XmlNode = doc.SelectNodes("Orders/OrderHeader").Item(k)
            PoNum = node.Item("CustomerPoNumber").InnerText
            Header = node.Item("ErrorMessages").InnerText
            Dim n As Integer = doc.SelectNodes("Orders/OrderDetails").Count
            For m As Integer = 0 To n - 1
                Dim element As XmlNode = doc.SelectNodes("Orders/OrderDetails").Item(m)
                Dim obj(3) As Object
                obj(0) = PoNum : obj(1) = Header
                For Each stocks As XmlNode In element.ChildNodes
                    Dim line As String = stocks.Item("Line").InnerText
                    Dim description As String = stocks.Item("ErrorMessages").InnerXml.Replace("</ErrorDescription><ErrorDescription>", " & ").Replace("<ErrorDescription>", "").Replace("</ErrorDescription>", "")
                    obj(2) = line : obj(3) = description
                    dt.Rows.Add(obj)
                Next
            Next
        Next
        Return dt
    End Function

GeneralRe: XML to DataTable/DataGrid Pin
Anoop Brijmohun1-Sep-11 20:49
Anoop Brijmohun1-Sep-11 20:49 
AnswerRe: XML to DataTable/DataGrid Pin
Simon_Whale31-Aug-11 13:43
Simon_Whale31-Aug-11 13:43 
QuestionAnimation effect by changing colors Pin
Razanust29-Aug-11 18:38
Razanust29-Aug-11 18:38 
AnswerMessage Removed Pin
29-Aug-11 21:17
professionalWayne Gaylard29-Aug-11 21:17 
GeneralRe: Animation effect by changing colors Pin
Dave Kreskowiak30-Aug-11 4:57
mveDave Kreskowiak30-Aug-11 4:57 
GeneralRe: Animation effect by changing colors Pin
Wayne Gaylard30-Aug-11 22:04
professionalWayne Gaylard30-Aug-11 22:04 
AnswerRe: Animation effect by changing colors Pin
Dave Kreskowiak30-Aug-11 5:06
mveDave Kreskowiak30-Aug-11 5:06 
GeneralRe: Animation effect by changing colors Pin
Luc Pattyn30-Aug-11 7:20
sitebuilderLuc Pattyn30-Aug-11 7:20 
AnswerRe: Animation effect by changing colors Pin
Wayne Gaylard30-Aug-11 22:02
professionalWayne Gaylard30-Aug-11 22:02 
GeneralRe: Animation effect by changing colors Pin
Dalek Dave31-Aug-11 12:30
professionalDalek Dave31-Aug-11 12:30 
GeneralRe: Animation effect by changing colors Pin
Wayne Gaylard31-Aug-11 20:01
professionalWayne Gaylard31-Aug-11 20:01 
GeneralPNG Based File Compression in .NET Pin
James Garner (jadaradix)29-Aug-11 16:27
James Garner (jadaradix)29-Aug-11 16:27 
QuestionCreating Multi-user db application Pin
Gagan.2029-Aug-11 4:25
Gagan.2029-Aug-11 4:25 
AnswerRe: Creating Multi-user db application Pin
ekolis29-Aug-11 8:32
ekolis29-Aug-11 8:32 
AnswerRe: Creating Multi-user db application Pin
Wayne Gaylard29-Aug-11 21:53
professionalWayne Gaylard29-Aug-11 21:53 
AnswerRe: Creating Multi-user db application Pin
Bert Mitton30-Aug-11 6:02
professionalBert Mitton30-Aug-11 6:02 
QuestionScreening programmers skills Pin
MadMax201128-Aug-11 22:40
MadMax201128-Aug-11 22:40 

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.