Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4115620
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:36:21+00:00 2026-05-20T22:36:21+00:00

i have a windows app in vb.net , i am trying to read a

  • 0

i have a windows app in vb.net , i am trying to read a xml file from my server(http://dev2010.abc.com/abc.xml).I am able to read abc.xml . now i have a requirement to show abc.xml in a rich text box in vb.net and then i have to show node and its value in combobox. I am able to do this with a directory(suppose that file is in C:/abc.xml)
Please suggest me the way to the way to load that xml file from server in a rich tex box and from there show the nodes and corresponding value in a combobox and display its output in a textbox..

Code in VB .NET

Imports System.Xml
Imports System.IO

Public Class Form1
    Inherits System.Windows.Forms.Form

Region " Windows Form Designer generated code "

Public Sub New()
    MyBase.New()

    InitializeComponent()



End Sub


Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    If disposing Then
        If Not (components Is Nothing) Then
            components.Dispose()
        End If
    End If
    MyBase.Dispose(disposing)
End Sub
Friend WithEvents txtFile As System.Windows.Forms.TextBox
Friend WithEvents txtResults As System.Windows.Forms.TextBox
Friend WithEvents btnList As System.Windows.Forms.Button
Friend WithEvents txtTagName As System.Windows.Forms.TextBox
Friend WithEvents lblFile As System.Windows.Forms.Label
Friend WithEvents lblTag As System.Windows.Forms.Label
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents DG_IPInfo As System.Windows.Forms.DataGridView

Private components As System.ComponentModel.Container


<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.lblTag = New System.Windows.Forms.Label
    Me.txtResults = New System.Windows.Forms.TextBox
    Me.btnList = New System.Windows.Forms.Button
    Me.lblFile = New System.Windows.Forms.Label
    Me.txtFile = New System.Windows.Forms.TextBox
    Me.txtTagName = New System.Windows.Forms.TextBox
    Me.ComboBox1 = New System.Windows.Forms.ComboBox
    Me.DG_IPInfo = New System.Windows.Forms.DataGridView
    CType(Me.DG_IPInfo, System.ComponentModel.ISupportInitialize).BeginInit()
    Me.SuspendLayout()
    '
    'lblTag
    '
    Me.lblTag.Location = New System.Drawing.Point(47, 30)
    Me.lblTag.Name = "lblTag"
    Me.lblTag.Size = New System.Drawing.Size(32, 16)
    Me.lblTag.TabIndex = 4
    Me.lblTag.Text = "Tag"
    '
    'txtResults
    '
    Me.txtResults.Location = New System.Drawing.Point(496, 239)
    Me.txtResults.Multiline = True
    Me.txtResults.Name = "txtResults"
    Me.txtResults.ScrollBars = System.Windows.Forms.ScrollBars.Both
    Me.txtResults.Size = New System.Drawing.Size(200, 309)
    Me.txtResults.TabIndex = 3
    '
    'btnList
    '
    Me.btnList.Location = New System.Drawing.Point(228, 30)
    Me.btnList.Name = "btnList"
    Me.btnList.Size = New System.Drawing.Size(40, 23)
    Me.btnList.TabIndex = 1
    Me.btnList.Text = "List"
    '
    'lblFile
    '
    Me.lblFile.Location = New System.Drawing.Point(82, 217)
    Me.lblFile.Name = "lblFile"
    Me.lblFile.Size = New System.Drawing.Size(100, 19)
    Me.lblFile.TabIndex = 5
    Me.lblFile.Text = "File"
    Me.lblFile.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
    '
    'txtFile
    '
    Me.txtFile.Location = New System.Drawing.Point(12, 239)
    Me.txtFile.Multiline = True
    Me.txtFile.Name = "txtFile"
    Me.txtFile.ScrollBars = System.Windows.Forms.ScrollBars.Both
    Me.txtFile.Size = New System.Drawing.Size(224, 309)
    Me.txtFile.TabIndex = 2
    '
    'txtTagName
    '
    Me.txtTagName.Location = New System.Drawing.Point(100, 30)
    Me.txtTagName.Name = "txtTagName"
    Me.txtTagName.Size = New System.Drawing.Size(104, 20)
    Me.txtTagName.TabIndex = 0
    Me.txtTagName.Text = "Status"
    '
    'ComboBox1
    '
    Me.ComboBox1.FormattingEnabled = True
    Me.ComboBox1.Location = New System.Drawing.Point(496, 179)
    Me.ComboBox1.Name = "ComboBox1"
    Me.ComboBox1.Size = New System.Drawing.Size(200, 21)
    Me.ComboBox1.TabIndex = 6
    '
    'DG_IPInfo
    '
    Me.DG_IPInfo.BackgroundColor = System.Drawing.SystemColors.ControlLightLight
    Me.DG_IPInfo.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
    Me.DG_IPInfo.Location = New System.Drawing.Point(12, 73)
    Me.DG_IPInfo.Name = "DG_IPInfo"
    Me.DG_IPInfo.Size = New System.Drawing.Size(461, 127)
    Me.DG_IPInfo.TabIndex = 7
    '
    'Form1
    '
    Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    Me.ClientSize = New System.Drawing.Size(833, 560)
    Me.Controls.Add(Me.DG_IPInfo)
    Me.Controls.Add(Me.ComboBox1)
    Me.Controls.Add(Me.txtResults)
    Me.Controls.Add(Me.txtTagName)
    Me.Controls.Add(Me.lblTag)
    Me.Controls.Add(Me.btnList)
    Me.Controls.Add(Me.lblFile)
    Me.Controls.Add(Me.txtFile)
    Me.Name = "Form1"
    Me.Text = "GetElementsByTagName"
    CType(Me.DG_IPInfo, System.ComponentModel.ISupportInitialize).EndInit()
    Me.ResumeLayout(False)
    Me.PerformLayout()

End Sub



Private xml_doc As XmlDocument


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim resolver As New XmlUrlResolver()
    Dim myUri As New Uri("http://dev2010.abc.com/abc.xml")

   ' Dim myUri As New Uri("http://localhost/test_abc/abc.xml")

    'Dim s1 As String = DirectCast(resolver.GetEntity(myUri, Nothing, GetType(String)), String)

    Dim s As Stream = DirectCast(resolver.GetEntity(myUri, Nothing, GetType(Stream)), Stream)


    Dim xmlTextReader As New XmlTextReader(s)
    Dim xdoc1 As New XmlDataDocument()
    xdoc1.DataSet.ReadXml(xmlTextReader, XmlReadMode.Auto)
    Dim ds As DataSet = xdoc1.DataSet
    'DG_LiveRates.DataSource = xdoc1.DataSet;
    'DataSet ds = new DataSet();
    Dim dt As DataTable = ds.Tables(0)
    DG_IPInfo.DataSource = dt


    Dim file_name As String = DataSubdirectory() & "\abc.xml"

    'Dim results As String

    txtFile.Text = GetFileContents(file_name)

    xml_doc = New XmlDocument()
    xml_doc.Load(file_name)
    ComboBox1.Items.Add("Status")
    ComboBox1.Items.Add("Ip")
    ComboBox1.Items.Add("CountryCode")
    ComboBox1.Items.Add("CountryName")
    ComboBox1.Items.Add("RegionCode")
    ComboBox1.Items.Add("RegionName")
    ComboBox1.Items.Add("City")
    ComboBox1.Items.Add("ZipCode")
    ComboBox1.Items.Add("Latitude")
    ComboBox1.Items.Add("Longitude")


End Sub


Private Sub btnList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnList.Click
    'Dim xml_node_list As XmlNodeList
    'Dim xml_node As XmlNode
    ' Dim results As String

    'xml_node_list = xml_doc.GetElementsByTagName(txtTagName.Text)


    'For Each xml_node In xml_node_list
    'results = results & xml_node.InnerText & vbCrLf

    'ComboBox1.Items.Add("S")
    'Next xml_node






    'txtResults.Text = results
End Sub


Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
    Dim wid As Integer
    Dim hgt As Integer

    wid = ClientSize.Width \ 2
    hgt = ClientSize.Height - txtFile.Location.Y
    If hgt < 10 Then hgt = 10
    lblFile.SetBounds(0, 0, wid, lblFile.Size.Height)
    txtFile.SetBounds(0, txtFile.Location.Y, wid, hgt)

    lblTag.SetBounds(wid, 0, lblTag.Size.Width, lblTag.Size.Height)
    txtResults.SetBounds(wid, txtFile.Location.Y, wid, hgt)
    btnList.SetBounds(ClientSize.Width - btnList.Size.Width, 0, btnList.Size.Width, btnList.Size.Height)
    wid = btnList.Location.X - lblTag.Location.X - lblTag.Size.Width - 10
    If wid < 10 Then wid = 10
    txtTagName.SetBounds(lblTag.Location.X + lblTag.Size.Width, 0, wid, txtTagName.Size.Height)
End Sub

Private Sub txtFile_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtFile.TextChanged

End Sub

Private Sub txtResults_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtResults.TextChanged

End Sub

Private Sub txtTagName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTagName.TextChanged

End Sub



Private Sub ComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
    Dim xml_node_list As XmlNodeList
    Dim xml_node As XmlNode
    Dim results As String

    xml_node_list = xml_doc.GetElementsByTagName(txtTagName.Text)


    For Each xml_node In xml_node_list
        results = results & xml_node.InnerText & vbCrLf


    Next xml_node






    txtResults.Text = results
End Sub

Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
    Dim xml_node_list As XmlNodeList
    Dim xml_node As XmlNode
    Dim results1 As String
    Dim results As String
    results1 = ComboBox1.Text
    xml_node_list = xml_doc.GetElementsByTagName(results1)


    For Each xml_node In xml_node_list
        results = results & xml_node.InnerText & vbCrLf

    Next xml_node






    txtResults.Text = results


End Sub

Private Sub DG_IPInfo_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_IPInfo.CellContentClick

End Sub

Private Sub lblFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblFile.Click

End Sub
End Class

Please suggest me some way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:36:21+00:00Added an answer on May 20, 2026 at 10:36 pm

    Me.lblTag.Location = New System.Drawing.Point(47, 30) Me.lblTag.Name = “lblTag” Me.lblTag.Size = New System.Drawing.Size(32, 16) Me.lblTag.TabIndex = 4 Me.lblTag.Text = “Tag”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application written in VB.NET ( NOT asp.net, it is a Windows
I get the above error when trying to run my .net app as it
I'm trying to get a VB.net (express 2010) app to connect to a socket
I am trying to host WCF serviec in managed Windows Service. Basically i have
I'm getting this error (see title) while trying to parse an XML file in
Trying to develop and test an ASP.NET MVC 2 as well as a hosted
Hi this question or problem i have its very hard i have search and
I've got a project that won't open with VS2008, it's a Windows CE 5.X
I have a WCF Service set up on my web site with a service.
I have written web apps with JSP in the past. Now, I'm getting started

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.