Results 1 to 6 of 6

Thread: Save text string to a text file on Pocket PC

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    3

    Save text string to a text file on Pocket PC

    I am having a similar problem to that of FireFox where he is trying to save text from a text box ot a .txt file on a pocket PC, I see that it wasn't resolved and was wondering if anyone has any answers?

    Thanks

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Save text string to a text file on Pocket PC

    This is in the help files, and all over the net, but...

    VB Code:
    1. Dim sw As StreamWriter = File.AppendText("\My Documents\myfile.txt")
    2.         sw.WriteLine(textbox1.text)
    3.         sw.Flush()
    4.         sw.Close()

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    3

    Re: Save text string to a text file on Pocket PC

    Thanks Petevick but I've tried that already, When I try Dim sw As StreamWriter I get the error Type 'StreamWriter' is not defined.

    I think it may have something to do with the dev environment? I'm writing an app for a mobile barcode scannin device that uses CE 4.2 and I'm using VB.Net 2003 (Compact Framework)
    Everything else so far is fine but I can't save the text I've scanned into a text file.

  4. #4
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Save text string to a text file on Pocket PC

    Usually that means that you don't have the correct reference in your project references, but I think this reference is System, and I find it hard to believe that you don't have that.

    How about the fully decorated line:

    Private sWriter As System.IO.StreamWriter
    My usual boring signature: Nothing

  5. #5
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: Save text string to a text file on Pocket PC

    Or
    Imports System.IO

    Pete

  6. #6

    Thread Starter
    New Member
    Join Date
    Aug 2006
    Posts
    3

    Re: Save text string to a text file on Pocket PC

    Yeah, that's more like it. Thanks PeteVick. I think I had a bit of finger trouble but it's working now!

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