Results 1 to 3 of 3

Thread: Create New File

  1. #1
    New Member
    Join Date
    Aug 12
    Posts
    5

    Create New File

    Hi again! I need some code on how to create a new .txt file in visual basic. Any suggestions would be great!

  2. #2
    Fanatic Member ThomasJohnsen's Avatar
    Join Date
    Jul 10
    Location
    Denmark
    Posts
    521

    Re: Create New File

    Link to MSDN File class.
    In truth, a mature man who uses hair-oil, unless medicinally , that man has probably got a quoggy spot in him somewhere. As a general rule, he can't amount to much in his totality. (Melville: Moby Dick)

  3. #3
    Angel of Code Niya's Avatar
    Join Date
    Nov 11
    Posts
    3,144

    Re: Create New File

    Here is an example of how to use the File class:-
    vbnet Code:
    1. '
    2.     Public Sub CreateTextFile()
    3.         Dim txtFile As String = "C:\MyTextFile.txt"
    4.  
    5.         System.IO.File.WriteAllText(txtFile, "This is text")
    6.     End Sub
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | Create Sortable BindingList(not mine) | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

Posting Permissions

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