Results 1 to 13 of 13

Thread: Saving dataset to txt file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    25

    Saving dataset to txt file

    Hi,

    Im wondering if anyone can tell me how I would save a dataset to a txt file?

    Im trying to create a receipt and after many failed attempts of trying to use reportviewer and print it that way I have decided that I will export all my data a txt file and hopefully find an easier way to print it.

    Thanks in advance.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Saving dataset to txt file

    Have you considered using html to create your receipts?
    It'd be quite easy to export + printing html is 1 line of code with a webbrowser control

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    25

    Re: Saving dataset to txt file

    could I use my dataset that way as well? My head is just fried with this whole thing now that Im struggling to even think of different ways.. and exporting it all to a txt file seemed the easiest in my head.

    Thanks for your reply =)

  4. #4
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Saving dataset to txt file

    here's an example of exporting a datatable to an html table + displaying it in a webbrowser control.
    when you have the table, you can use the wbc's built in .Print method:

    http://www.vbforums.com/showthread.p...html-reporting

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    25

    Re: Saving dataset to txt file

    Thanks very much for your help.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    25

    Re: Saving dataset to txt file

    Turns out that I cant open it because I have a newer version of studio.

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Saving dataset to txt file

    which version?

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    25

    Re: Saving dataset to txt file

    Visual Studio Pro 2012

  9. #9
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Saving dataset to txt file

    here it is in vb2012:

    dynamic datatable to html table.zip

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    25

    Re: Saving dataset to txt file

    you wee star =)

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    25

    Re: Saving dataset to txt file

    Sorry where am I putting my dataset in that?

  12. #12
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Saving dataset to txt file

    a dataset is a collection of datatables.
    the example uses a datatable created in code + shows how to create an html table from that.
    it's not a complete custom built solution for your problem, but it is a possible method for you to use to print your receipts, but it'll require some effort on your part...

  13. #13

    Thread Starter
    Junior Member
    Join Date
    Nov 2013
    Location
    Ireland
    Posts
    25

    Re: Saving dataset to txt file

    I know that, I wasnt intending on not putting effort into it...

Tags for this Thread

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