Results 1 to 4 of 4

Thread: Textfile

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    51

    Arrow

    I want to code a form that im able to create a text file such like this:

    Example Textfile:

    IP"192.168.100.10" Subnet"255.255.255.0"

    The Word "IP" and "Subnet" should be set automaticly on this position and the two adresses should come from two seperatet textboxes im my form!

    My question is : HOW??? :-))

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Simply open a file for output and use the print keyword to type to it.
    Code:
    Dim iFile As Integer
    
    iFile = FreeFile
    Open "C:\MyFile.txt" For Output As #iFile
    Print #iFile, "IP "; txtIPAddress; " Subnet "; txtSubnet
    Close #iFile
    Good luck!

  3. #3
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Joacim,

    That is a more elegant solution than I came up with. Minor point. If you need the double quotes in the output string, just put in chr(34).

    Code:
    Print #iFile, "IP "; Chr(34); txtIpAddress; Chr(34); " Subnet "; Chr(34); txtSubnet; Chr(34)

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yes, you can also add two quotation marks.
    Code:
    Print #iFile, "IP """; txtIPAddress; """ Subnet """; txtSubnet; """"

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