how to get the text from a richtextbox in a form to another form inside a richtextbox

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi , I am creating a text editor like notepad. Well its an advance type because it is a tabbed notepad type. It saves html files.
I only created tabcontrol on the design time named TabControl1. the tabpages and the richtextbox are created on the form load and when adding tabs.
the code below is the addtab()

<div style="color:black; background-color:white
<pre> <span style="color:blue Private <span style="color:blue Sub AddTab(<span style="color:blue Optional <span style="color:blue ByVal file <span style="color:blue As <span style="color:blue String = <span style="color:blue Nothing)

NewRTB.AllowDrop = <span style="color:blue True
NewTab.AllowDrop = <span style="color:blue True

<span style="color:blue Dim TabText <span style="color:blue As <span style="color:blue String = <span style="color:#a31515 "Untitled"
<span style="color:blue Dim RTBText <span style="color:blue As <span style="color:blue String = <span style="color:blue Nothing


<span style="color:blue If <span style="color:blue Not IsNothing(file) <span style="color:blue Then
<span style="color:blue If <span style="color:blue My.Computer.FileSystem.FileExists(file) <span style="color:blue Then
NewRTB.Tag = file

TabText = <span style="color:blue My.Computer.FileSystem.GetFileInfo(file).Name
<span style="color:blue Dim reader <span style="color:blue As <span style="color:blue New System.IO.StreamReader(file)
RTBText = reader.ReadToEnd

reader.Close()
<span style="color:blue Else
MsgBox(<span style="color:#a31515 "Sorry that file doesnt exist")
<span style="color:blue End <span style="color:blue If
<span style="color:blue End <span style="color:blue If

NewTab.Text = TabText
NewTab.Tag = NewRTB

NewRTB.Parent = NewTab
NewRTB.Dock = DockStyle.Fill
NewRTB.Text = RTBText

TabControl1.TabPages.Add(NewTab)
TabControl1.SelectedTab = NewTab
Tab = NewTab
RTB = NewRTB


<span style="color:blue End <span style="color:blue Sub
[/code]


<br/>
the name of the form where the tabpages can be seen in named MainInterface. It is the first to load when the program executes. I have another form named frmInsert where the user will select t the html tags that the user wants. the tags goes to the richtextbox
named rtbcode. and when the user clicks the button named btnok. the text of the rtb code must be placed on the MainInterface then in the Richtextbox named RTB and placed it on where teh cursor is positioned on the richtextbox. I cant figure out
how to do tha so I am asking you guys if you can help me with this.
I have a toolstrip in MainInterface named insert where if the user clicks, the frmInsert shows.
hope you can help me
<br/>

View the full article
 
Back
Top