Solved

Help with parsing and loading data in listbox

Posted on 2012-04-04
7
230 Views
Last Modified: 2012-04-04
Hello,

The data in my xml file is in the following format:

<Data>1-Data; 2-data; 3-Data</Data>

How do I load the data in a listbox in the following format:

1-Data
2-Data
3-Data

Victor
0
Comment
Question by:vcharles
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
zofcentr earned 500 total points
ID: 37804879
Try this way.
1. Load XML using  XMLDocument example here: http://vbnetsample.blogspot.com/2007/07/read-xml-content-by-xmldocument.html.2.
2. Get inner text of your node into string  - example under above document link also.
3. Split this string using split funciton of String class - example here http://www.dotnetperls.com/split-vbnet.
4. Assign array returned by Split function to your listbox.
0
 

Author Comment

by:vcharles
ID: 37804918
Thanks, will try it an get back to you.
0
 

Author Comment

by:vcharles
ID: 37805310
Hello,

When I try to pass the data from my textbox (1-Data; 2-Data; 3-Data) to the listbox using the code below,

 C1NSN.Text = dtNSN.Rows(0).Item("NSN")
        Dim tmp() As String = C1NSN.split(";")
        For i As Integer = 0 To tmp.Length - 1
            ListBox1.Items.Add(tmp(i))
        Next

I receive the following error:

'split' is not a member of 'System.Web.UI.WebControls.TextBox'.

How do  i fix this error?

Thanks,

Victor
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

Author Comment

by:vcharles
ID: 37805319
Hi,

I got it to work with

Dim tmp() As String = C1NSN.Text.Split(";")

Will get back to you.
0
 

Author Comment

by:vcharles
ID: 37805334
Can This also be done with a GridView instead of a Listbox?

C1NSN.Text = dtNSN.Rows(0).Item("NSN")
        Dim tmp() As String = C1NSN.Text.split(";")
        For i As Integer = 0 To tmp.Length - 1
            'ListBox1.Items.Add(tmp(i))
             GridView1.??????
        Next
0
 
LVL 3

Expert Comment

by:zofcentr
ID: 37805594
Yes it can be done with grid.
Depending on grid you are using (datagrid or datagridview) you have to add column and then add rows with specific values in particular column.

HEre you can find some examples of using datagridview: http://www.dotnetperls.com/datagridview-vbnet.
0
 

Author Comment

by:vcharles
ID: 37806017
Thanks!
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Service FileSystemwatcher isse 9 46
ASP.NET - Why is accordion not working? 3 49
Problem to copy file 14 51
asp.net web app 3 23
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question