Need help with a text box? vb2008.net

Visual Basic 2008.net need help with a text box

Page 1 of 1

10 Replies - 6374 Views - Last Post: 30 May 2008 - 08:12 AM Rate Topic: -----

#1 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Need help with a text box? vb2008.net

Post icon  Posted 29 May 2008 - 01:12 PM

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 :P

This post has been edited by StealthTools: 29 May 2008 - 01:15 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Need help with a text box? vb2008.net

#2 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Need help with a text box? vb2008.net

Posted 29 May 2008 - 01:59 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.
Was This Post Helpful? 0
  • +
  • -

#3 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: Need help with a text box? vb2008.net

Posted 29 May 2008 - 03:20 PM

View Postjayman9, on 29 May, 2008 - 01:59 PM, said:

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..
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Need help with a text box? vb2008.net

Posted 29 May 2008 - 03:34 PM

Here is an example of reading a text file


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


Was This Post Helpful? 0
  • +
  • -

#5 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: Need help with a text box? vb2008.net

Posted 29 May 2008 - 05:23 PM

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 - 05:27 PM

Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Need help with a text box? vb2008.net

Posted 29 May 2008 - 09:30 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.
Was This Post Helpful? 0
  • +
  • -

#7 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: Need help with a text box? vb2008.net

Posted 30 May 2008 - 05:04 AM

View PostPsychoCoder, on 29 May, 2008 - 09:30 PM, said:

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 - 05:06 AM

Was This Post Helpful? 0
  • +
  • -

#8 StealthTools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 52
  • Joined: 11-March 08

Re: Need help with a text box? vb2008.net

Posted 30 May 2008 - 06:24 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:

 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 - 06:24 AM

Was This Post Helpful? 1

#9 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Need help with a text box? vb2008.net

Posted 30 May 2008 - 06:33 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?
Was This Post Helpful? 0
  • +
  • -

#10 RodgerB  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 66
  • View blog
  • Posts: 2,284
  • Joined: 21-September 07

Re: Need help with a text box? vb2008.net

Posted 30 May 2008 - 06:45 AM

View PostStealthTools, on 30 May, 2008 - 10:04 PM, said:

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.

View PostStealthTools, on 30 May, 2008 - 10:04 PM, said:

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.

View PostStealthTools, on 30 May, 2008 - 10:04 PM, said:

eagerly typed for me


I lol'd.
Was This Post Helpful? 1

#11 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Need help with a text box? vb2008.net

Posted 30 May 2008 - 08:12 AM

View PostStealthTools, on 30 May, 2008 - 06:24 AM, said:

It is alot easier than I thought it would be.

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1