textbox save it as .txt file

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts Page 1 of 1
Contributors
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

textbox save it as .txt file
troop
ok ! this might be hard but i need to know :(, i already see many tutorials for making notepad save/open feature but the program im making doesnt need that with dialogs i mean

i just want people to press Save it will save texbox1.text in a saved1.txt in C:/test/
and then they press open it will open saved1.txt from C:/test/saved1.txt into textbox1.text

if this is possible without dialog boxes tell me :D loove;
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: textbox save it as .txt file
Dummy1912
hello #troop

you can always try it like this:

'save
Code: Select all
                    Dim sr As New System.IO.StreamWriter("c:\test\saved1.txt")
                    Dim s As String = TextBox1.Text
                    sr.Write(s)
                    sr.Close()
'open
Code: Select all
                Dim sr As New System.IO.StreamReader("c:\test\saved1.txt")
                TextBox1.Text= sr.ReadToEnd
                sr.Close()

visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: textbox save it as .txt file
troop
i will try this now :D
#Dummy_Is_best #Thanks :D
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: textbox save it as .txt file
troop
works :D
after watching many tutorials my brother told me to create a login system without looking in youtube, he asked me to do it with those checks, Check username chars to be + 2 and password match etc

do u like my codes guys :D
Code: Select all
    Try
            If My.Computer.FileSystem.DirectoryExists(Loc) Then
            Else
                My.Computer.FileSystem.CreateDirectory(Loc & "\accounts\")
            End If


            If txtBox3.Text.Length < 2 Then
                MsgBox("Your username should be more than 2 characters!")
            Else
                If txtBox4.Text = Nothing Then
                    MsgBox("Please enter a password")
                Else
                    Dim accLoc As String = Loc & "\accounts\" & txtBox3.Text & "\password.txt"
                    If My.Computer.FileSystem.DirectoryExists(accLoc) Then
                        MsgBox("Account already exist")
                    Else
                        If txtBox4.Text = txtBox5.Text Then
                            My.Computer.FileSystem.CreateDirectory(Loc & "\accounts\" & txtBox3.Text & "\")
                            Dim sr As New System.IO.StreamWriter(accLoc)
                            Dim s As String = txtBox4.Text
                            sr.Write(s)
                            sr.Close()
                            MsgBox("Account successfully created, we will auto login you!")
                            txtBox1.Text = txtBox3.Text
                            txtBox2.Text = txtBox4.Text
                            txtBox3.Clear() : txtBox4.Clear() : txtBox5.Clear()
                            btnLog.PerformClick()

                        Else
                            MsgBox("Please comfirm your password")
                        End If
                    End If
                End If
            End If
        Catch ex As Exception
            MsgBox(ErrorToString)
        End Try
sorry i used dummy code for saving :D
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: textbox save it as .txt file
comathi
It's a nice way of learning, but just don't use it to store any actual passwords :lol:

Plain text files are the least secure method for keeping confidential information.
User avatar
dualz
VIP - Donator
VIP - Donator
Posts: 29
Joined: Mon Jul 15, 2013 9:47 pm

Re: textbox save it as .txt file
dualz
indeed they are not good, ok for limited information but not the likes of passwords or even usernames.

when it comes to storing say save username into any of my applications i create a hex key and store it in the registry.

passwords are always base64 encrypted to my mssql server's and as an extra security feature depending on the application i write i also add a usb key so you have to have the usb device plugged in or it wont even get to the login screen :d
Dualz
Co-Owner TADStools Network
  • Microsoft Systems Engineer
    Microsoft Software Engineer
    Cisco Certified Network Engineer
    Programming Languages: Delphi, Python, Cron, PHP, HTML, ASP.Net, Cold Fustion, VB.net, C, C++, C#, XAML, IOS, Android, Java, ASM
User avatar
troop
Dedicated Member
Dedicated Member
Posts: 75
Joined: Sat Sep 28, 2013 11:57 am

Re: textbox save it as .txt file
troop
im making a simple game i found a tutorial on here, i will tell ueverything about it later but i mean this is not a real huge app its ok if they see passwords ;p
7 posts Page 1 of 1
Return to “Coding Help & Support”