EDN Admin
Well-known member
hi , I am creating a text editor. I have a form name frmMain. Inside of it, I have a TabControl named TabControl1. It is the only control that is created in design time. My text editor is a tabbed program. I have a addtab() function that whenever
teh user clicks the toolstrip addtab, the tabcontrol adds tabs. THe code below is for the addtab().
Inside the tabcontrol that is created on run time are the tabpage and inside of it is a richtextbox named RTB. Now , the problem is that whenever I Have multiple tabs , and I want to set a text to the RTB, the text are not going to the selected tab
and RTB that was suppose to accept the text. can you help me to deal withe tabs especially the same name of RTB
Hope you can help me
<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]
View the full article
teh user clicks the toolstrip addtab, the tabcontrol adds tabs. THe code below is for the addtab().
Inside the tabcontrol that is created on run time are the tabpage and inside of it is a richtextbox named RTB. Now , the problem is that whenever I Have multiple tabs , and I want to set a text to the RTB, the text are not going to the selected tab
and RTB that was suppose to accept the text. can you help me to deal withe tabs especially the same name of RTB
Hope you can help me
<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]
View the full article