Results 1 to 8 of 8

Thread: How to use InputBox with StreamWriter [Resolved]

  1. #1

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134

    Thumbs up How to use InputBox with StreamWriter [Resolved]

    HI All!
    I’ve been trying this for a while now and am still unable to make this work.
    In my menu I am making a call to an InputBox and the result of the InputBox is supposed to be used to Create or Replace a file in my App. Folder.
    I’m trying to do this with the StreamWriter but I can’t seem to be able to get the coding together.
    VB Code:
    1. Dim Prompt, rout As String
    2. Prompt = "Please input your Banks Routing Number"
    3. rout = InputBox(Prompt, "Routing Number")
    4. ‘?????????
    Can someone Pease give me an example on how to finish this line.??
    The only thing I know how to do is create a File with StreamWriter but I don’t know how to do it in conjunction with an InputBox.

    Thanks!!
    Last edited by Rally2000; Dec 17th, 2003 at 07:52 PM.

  2. #2
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    I dont get what you want. You want to create a file? open a file? which should be the file's name?
    \m/\m/

  3. #3

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    I want to create or replace a File "rout.txt"

  4. #4
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    C# code:
    Code:
    StreamWriter sw = new StreamWriter("C:\\lol.txt");
    using (sw) {
    	sw.WriteLine("your text here");
    	sw.Close();
    }
    I believe it's equivalent in vb.net is something like:
    Code:
    Dim sw as new StreamWriter("rout.txt")
    sw.Writeline("your text here")
    sw.Close()
    \m/\m/

  5. #5

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    Sorry! That still don't help the text that is supposed to be replaced needs to be taken from the InputBox result.
    That is the part I'm having trouble with.
    Thanks!!

  6. #6
    yay gay PT Exorcist's Avatar
    Join Date
    Apr 2002
    Location
    . . . my reason of shame
    Posts
    2,729
    So you want to open the file rout.txt, and replace what the user puts in the inputbox? but replace by what?
    \m/\m/

  7. #7

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    No! Sorry if I’m not making myself clear enough!
    I’m going to put it in steps.
    1. User goes to menu and selects New Routing #
    2. Input Box pops up asking the User to enter new Routing Number
    3. Input from input box needs to replace an existing file in a Folder that I’m using to display a routing Number in a Label
    I did not feel comfortable enough to use Reg. so I went with File IO.
    Hope this explains it better
    Thanks!

  8. #8

    Thread Starter
    Addicted Member Rally2000's Avatar
    Join Date
    Dec 2003
    Location
    Central USA
    Posts
    134
    Never mind!
    Format had me fouled up.
    Got it going now.
    Thanks

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