Join 150,092 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,819 people online right now. Registration is fast and FREE... Join Now!
Hi, I want to makee a text box that saves itself within my web browser I made in Visual Basic 2008 Express Edition..
I have a RichTextBox1 that I corrently use to make notes in while I play my games..
How would I save the text in the RichTextBox1, so when I open the browser again the text is there..?
I could make a button to the side of the RichTextBox1 and add code to it to umm. I think you would have to create a file and save the text in that file and when another button is pressed anything in that file is outputted to the browser RichTextBox1? I don't know, lol..
I hope what I have here is understandable..
Thanks for any help!
ps: This isn't for a school assignment or anything... out for the summer.. and doing this for fun
This post has been edited by StealthTools: 29 May, 2008 - 12:15 PM
Use a StreamWriter object to write the text to a file. And then on Load, use a StreamReader object to read the text file and put the data into your RichTextBox.
Use a StreamWriter object to write the text to a file. And then on Load, use a StreamReader object to read the text file and put the data into your RichTextBox.
I don't understand how to use that? it is like 4 lines of code... i'm a newbie at this..
Dim contents As String = String.Empty Using StreamReader reader = New StreamReader("C:\MyFile.txt") 'Make sure we have data to read Do While reader.Peek() <> -1 'On each iteration of the loop we write the next line contents += reader.ReadLine() Loop
'Now we write the contents to a RichTextBox rtbSample.Text = contents End Using
Using RitchTextBox1 and Button13 and Button14 could you make Button13 save the text in RitchTextBox1 and Button14 load the saved text back into RitchTextBox1?
Could anyone code this for me so I could easily slip it into my program?
This post has been edited by StealthTools: 29 May, 2008 - 04:27 PM
I'm really sorry but we're not going to do your programming for you. You've been given excellent tips and examples, now you just need to work on it. We will gladly help, we have no problems with that, but we're not just going to code it so you can copy & paste it into your application, thats not what Dream.In.Code is for.
I'm really sorry but we're not going to do your programming for you. You've been given excellent tips and examples, now you just need to work on it. We will gladly help, we have no problems with that, but we're not just going to code it so you can copy & paste it into your application, thats not what Dream.In.Code is for.
Well I am terribly sorry that I have no idea how to code Visual Basic (except for simple stuff) and that you guys do not want to help me learn this language. I am switching to another forum where the people love to code and will help me learn in any way they can, because they are just good people who love what they do.
And if I did code some junk it would be wrong anyway, and someone would have to correct it.
This post has been edited by StealthTools: 30 May, 2008 - 04:06 AM
For those of you surfing the web and want to know hot to do this.. here's the code that "VBForums.com" eagerly typed for me:
CODE
1. Public Class Form1 2.
3. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 4. Me.RichTextBox1.SaveFile("C:\Documents and Settings\mas111\Bureau\test.txt") 5. End Sub 6.
7. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 8. Me.RichTextBox1.Clear() 9. Me.RichTextBox1.LoadFile("C:\Documents and Settings\mas111\Bureau\test.txt") 10. End Sub 11. End Class
Thanks to "VBForums.com" for allowing me to learn how to do this. It is alot easier than I thought it would be.
This post has been edited by StealthTools: 30 May, 2008 - 05:24 AM
Hey lookie, StealthTools didnt even have to try, he just went and found a forum where he can cry and whine and people will do his work for him, isn't that just sweet?
Well I am terribly sorry that I have no idea how to code Visual Basic (except for simple stuff) and that you guys do not want to help me learn this language. I am switching to another forum where the people love to code and will help me learn in any way they can, because they are just good people who love what they do.
Nobody here wants to help you copy and paste code written by others without you showing some sort of effort to resolve the problem yourself. We do not give fully functional apps, we give answers to problems, it is your job to implement these answers and turn them into solutions.
We want you to help yourself learn the language by fiddling and experimenting with the code, rather than asking for it as it is much more beneficial for you; we aim to please those who like to help themselves.
QUOTE(StealthTools @ 30 May, 2008 - 10:04 PM)
And if I did code some junk it would be wrong anyway, and someone would have to correct it.
Nobody learns something as complex as programming in a day, and with that attitude you're never going to learn anything.
By now you should have learnt to read the programming forum rules before asking questions and demanding answers.
This is something we already knew and had you put forth even a smidgen of effort, you would have very quickly realized this yourself. In addition, you might even have learned something.