did you google yet?...
google for streamwriter.
How do you make an option in vb.net to save text to desktop?
did you google yet?...
google for streamwriter.
Let me google that for you
Click It Click It Click It, its majix
NextGen1 (03-15-2010)
Here you go. Thank me please
Change the user name to yours
[php]Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim TextFile As New StreamWriter("c:\Users\Zack\Desktop\test.txt")
TextFile.WriteLine("Text here")
' make more of these TextFile.WriteLine("Text here")to get more lines.
TextFile.Close()
End Sub
End Class[/php]
Need Help With Coding or Something??? MSN me
zmansquared@hotmail.com
I am the one and only Microsoft Fag!!!
Quote:
Originally Posted by Arhk
All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
~
Take this Pic everyone!
next-
Professionally and commercially you would want to do this without hard-coding the direct path , because if a 3rd party uses it, they will not be able to save the txt file to the desktop path.
Use
[php]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim DesktopPath As String = Environment.GetFolderPath(Environment.SpecialFolde r.DesktopDirectory)
Dim TextFile As New StreamWriter(DesktopPath & test.txt")
TextFile.WriteLine("Text here") ' or textbox.text
' make more of these TextFile.WriteLine("Text here")to get more lines.
TextFile.Close()
End Sub
[/php]
A good note to all developers is to remember that vb.net allows you to access user folders as special folders without hardcoding the user name and path
[php]
Environment.SpecialFolder.
[/php]
This will give you access to
Cookies
Desktop
My Pictures
My Documents
History
etc
etc
Without the need for the username
added to code snippets vault post 1
this will allow saving to anyones desktop
Last edited by NextGen1; 03-15-2010 at 06:37 PM.
You copied some of my code nextgen . LOL
Need Help With Coding or Something??? MSN me
zmansquared@hotmail.com
I am the one and only Microsoft Fag!!!
Quote:
Originally Posted by Arhk
All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
~
Take this Pic everyone!
next-
Its MSDN Standard, But yes I part of your above example to make sense of the prior :d
Last edited by NextGen1; 03-15-2010 at 07:28 PM.
Woot Nextgen1 used one of my examples WOOT. HAH thanks
Need Help With Coding or Something??? MSN me
zmansquared@hotmail.com
I am the one and only Microsoft Fag!!!
Quote:
Originally Posted by Arhk
All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
~
Take this Pic everyone!
next-
OR
[php] My.Computer.FileSystem.WriteAllText(My.Computer.Fi leSystem.SpecialDirectories.Desktop & "\filename.txt", "Text here...", False)
[/php]