Results 1 to 5 of 5

Thread: Help with formatting csv file

  1. #1

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    Help with formatting csv file

    Hi All,

    i have written a small tool in vb .net 2005, it basically runs a batch command , dumps the output in a csv file & then loads the same csv in a richtextbox. Now the the problem is formatting the text placed in the RTB, my csv contains commas "," as seperators, so i'm using "replace" function to replace comma with a "tab" space, but due to un-even words the are still unformatted. For eg. the output looks something like this :

    data1 data2 data3 data4
    123 123anothertestString testdata3 test111
    sample testString testdata3 test111
    sample testingString anotherdata3 anothertest111



    which shud look like a actual table (cnt really show 1 here)


    Any way i can achieve this in a RTB? or is there any other control i shud load the csv in? the reason i'm using RTB is that after the file is loaded i'm searching for certain text & highlighting it...

    help is much appreciated...

  2. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Help with formatting csv file

    Rtf format has the formatting codes for tables, there must be some information on the web. (Simple test - prepare a table in MS Word and save the file as RichText) - there will be table there.
    Still, if you're displaying some table the DataGridView fits better for this task (if you plan to process this data somehow).
    For presentation purposes only you can use either RTF formatting for tables or convert your CSV into a HTML table and use a webbrowser control to display it.

  3. #3

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    Question Re: Help with formatting csv file

    Quote Originally Posted by cicatrix View Post
    Rtf format has the formatting codes for tables, there must be some information on the web. (Simple test - prepare a table in MS Word and save the file as RichText) - there will be table there.
    Still, if you're displaying some table the DataGridView fits better for this task (if you plan to process this data somehow).
    For presentation purposes only you can use either RTF formatting for tables or convert your CSV into a HTML table and use a webbrowser control to display it.
    thx for reply...

    yea...i cud read a table from rtf in "wordpad" , but that still doesn't point me anywhere i have data in "data1,data2,dat3" format in a csv how do i convert that to a table ? also wht would be simplest way to load a csv into a datagrid view ?

  4. #4

    Thread Starter
    Lively Member sk8er_boi's Avatar
    Join Date
    Jun 2010
    Posts
    65

    Re: Help with formatting csv file

    Quote Originally Posted by sk8er_boi View Post
    thx for reply...

    yea...i cud read a table from rtf in "wordpad" , but that still doesn't point me anywhere i have data in "data1,data2,dat3" format in a csv how do i convert that to a table ? also wht would be simplest way to load a csv into a datagrid view ?
    sorry for double posting...but anyone pls ??? this is really urgent & important for me...

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width