dataset from tab separated

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

Hello

I want to create a asp.net / winform application, which has a text box.

In the text box, the user will paste data (copied from another source), in
tab separated format.

Supposedly, all the columns are always in a predetermined order, how can I
put this into a dataset and bind to it ..

Any input would be appreciated.

Thanks

Hemang
 
Hi,

What you need to do is to create empty DataTable first that will have
required structure. Then you read the string and use Split method of String.
It allows to split delimited data into array. Now you need to add new row to
the dataTable and populate it from array
 
Boy sounds intimidating.

The empty dataTable should I create it in visual dataset ?

Is there any sample code for "splitting delimited data into array" and then
into datatable?

Thanks
 
Hi,

No, you do not have to create datatable visually, you could do it on a fly.
To split string into array just next kind of code

dim loValues() as string

loValues=mystring.Split(" ") 'assuming that delimiter is a space character

--
Val Mazur
Microsoft MVP

http://xport.mvps.org
 
It is a Tab delimted file

How do I Split on Tab?
Val Mazur (MVP) said:
Hi,

No, you do not have to create datatable visually, you could do it on a
fly. To split string into array just next kind of code

dim loValues() as string

loValues=mystring.Split(" ") 'assuming that delimiter is a space character

--
Val Mazur
Microsoft MVP

http://xport.mvps.org
 
Back
Top