-
Nov 25th, 2012, 02:46 AM
#1
Thread Starter
Member
Putting text from a textbox into a richtextbox
Okay, so i am developing this program, where you fill in the details and when you press create it pops up a window that had a bunch of code with the correct details from the textboxes in the code?
So Say if it asks for my IP address, i enter the IP address, and when i click create the next window will have the code with my IP in the code.
When i enter the details, i want the details to be entered inside of here:
<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0" id="habbo" width="720" height="540">
<param name="src" value="TEXTBOX4">
<param name="swRemote" value="swSaveEnabled='true' swVolume='true' swRestart='false' swPausePlay='false' swFastForward='false' swTitle='Habbo Hotel' swContextMenu='true' ">
<param name="swStretchStyle" value="none">
<param name="swText" value="">
<param name="bgColor" value="#000000">
<param name="sw6" value="external.texts.txt=TEXTBOX6">
<param name="sw2" value="connection.info.host=TEXTBOX1;connection.info.port=TEXTBOX3">
<param name="sw4" value="connection.mus.host=game.habbohotel.nl;connection.mus.port=30001">
<param name="sw3" value="client.reload.url=TEXTBOX2">
<param name="sw1" value="site.url=http://www.habbohotel.nl;url.prefix=http://www.habbohotel.nl">
<param name="sw5" value="external.variables.txt=TEXTBOX5">
<embed src="TEXTBOX4" bgColor="#000000" width="720" height="540" swRemote="swSaveEnabled='true' swVolume='true' swRestart='false' swPausePlay='false' swFastForward='false' swTitle='Habbo Hotel' swContextMenu='true'" swStretchStyle="none" swText="" type="application/x-director" pluginspage="http://www.macromedia.com/shockwave/download/" sw6="external.texts.txt=TEXTBOX6" sw2="connection.info.host=TEXTBOX1;connection.info.port=TEXTBOX3" sw4="connection.mus.host=game.habbohotel.nl;connection.mus.port=30001" sw3="client.reload.url=TEXTBOX2" sw1="site.url=http://www.habbohotel.co.uk;url.prefix=http://www.habbohotel.co.uk" sw5="external.variables.txt=TEXTBOX5" >
</embed>
</object>
So this would be in the RichTextBox on the loader.vb window and when i click create on the Form1.vb it enters the info from Form1.vb into the RichTextBox in Loader.vb how can i do this?
-
Nov 25th, 2012, 05:38 AM
#2
Re: Putting text from a textbox into a richtextbox
The simplest way might be to put the html, exactly as you've posted it above into a file, read the file into your program, use the Replace Function to replace the text 'TEXTBOX1' etc with the values from the textboxes, then put the modified data into the rtb on the loader form.
Code:
Option Explicit
Private Sub cmdCreate_Click()
Dim intFile As Integer
Dim strFile As String
Dim strData As String
loader.rtb.Text = vbNullString
intFile = FreeFile
strFile = "C:\MyDir\Myhtml.txt"
Open strFile For Input As intFile
strData = Input(LOF(intFile), intFile)
Close intFile
strData = Replace(strData, "TEXTBOX1", txt1.Text)
strData = Replace(strData, "TEXTBOX2", txt2.Text)
strData = Replace(strData, "TEXTBOX3", txt3.Text)
strData = Replace(strData, "TEXTBOX4", txt4.Text)
strData = Replace(strData, "TEXTBOX5", txt5.Text)
strData = Replace(strData, "TEXTBOX6", txt6.Text)
loader.rtb.Text = strData
loader.Show
End Sub
-
Nov 25th, 2012, 09:45 AM
#3
Re: Putting text from a textbox into a richtextbox
Actually it seems that this is for VB.Net as VB6 and earlier do not use names like Form1.VB and Loader.VB. A lot of VB6 code will work in VB.Net but these are not the methods that should be used when working in VB.Net
The concept of loading from the file is sound. In VB.Net you can use any one of several different methods to read the file then place it into the textbox. ReadAllText may be the option you would want to use. Also note that in VB6 you can pass a filename to the RTB control and it will load the file for you, not sure if this is an option in VB.Net or not but I would think it is.
-
Nov 25th, 2012, 09:59 AM
#4
Re: Putting text from a textbox into a richtextbox
Looking at OP's recent posts they've all been in the .net forums. Should have checked before responding, although the logic suggested may still be sound. The implementation, however, may be different.
-
Nov 25th, 2012, 01:07 PM
#5
Thread Starter
Member
Re: Putting text from a textbox into a richtextbox
Originally Posted by Doogle
Looking at OP's recent posts they've all been in the .net forums. Should have checked before responding, although the logic suggested may still be sound. The implementation, however, may be different.
Im sorry for posting in the wrong section as to i canno't fint the correct section.
You guys have always helped me in this section. i wont post here anymore.
but thanks for the help.
-
Nov 25th, 2012, 01:36 PM
#6
Re: Putting text from a textbox into a richtextbox
You should be posting here http://www.vbforums.com/forumdisplay...ual-Basic-.NET
for questions related to VB versions newer than 1998
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|