?
Solved

Help with parsing and loading data in listbox

Posted on 2012-04-04
7
Medium Priority
?
232 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 2000 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 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