yigit_sertac
Member
- Joined
- Apr 7, 2012
- Messages
- 5
- Programming Experience
- 5-10
Hello,
I have a problem adding richtextbox in run time. the problem is when I tried 2 rtbs in splitcontainer's panel, just second one appears. Below the code I use:
Private defaultText As New RichTextBox
Private _controls As New List(Of Control)
Private isim As String = "RichTextBox"
Private Sub FindControlRecursive(ByVal list As List(Of Control), ByVal parent As Control, ByVal ctrlType As System.Type)
If parent Is Nothing Then
Exit Sub
End If
If parent.GetType Is ctrlType Then
list.Add(parent)
End If
For Each child As Control In parent.Controls
FindControlRecursive(list, child, ctrlType)
Next
End Sub
Private Sub RichTextBoxYukle(ByVal Panel As Object)
FindControlRecursive(_controls, Me, GetType(RichTextBox))
Dim adet As Integer = _controls.Count
If adet = 0 Then
With defaultText
.Dock = System.Windows.Forms.DockStyle.Fill
.Location = New System.Drawing.Point(0, 0)
.Multiline = True
.Name = isim + "1"
.TabIndex = 0
.Tag = 1
End With
Panel.Controls.Add(defaultText)
Else
With defaultText
.Dock = System.Windows.Forms.DockStyle.Fill
.Location = New System.Drawing.Point(0, 0)
.Multiline = True
.Name = isim + (adet + 1).ToString
.TabIndex = 1 + adet
.Tag = 1 + adet
End With
Panel.Controls.Add(defaultText)
End If
_controls.Clear()
End Sub
Private Sub orion_Load(sender As Object, e As EventArgs) Handles Me.Load
SC.Panel1MinSize = (Me.AnaPanel.Size.Width / 2) - 2
SC.Panel2MinSize = (Me.AnaPanel.Size.Width / 2) - 2
RichTextBoxYukle(SC.Panel1)
RichTextBoxYukle(SC.Panel2)
End Sub
I have a problem adding richtextbox in run time. the problem is when I tried 2 rtbs in splitcontainer's panel, just second one appears. Below the code I use:
Private defaultText As New RichTextBox
Private _controls As New List(Of Control)
Private isim As String = "RichTextBox"
Private Sub FindControlRecursive(ByVal list As List(Of Control), ByVal parent As Control, ByVal ctrlType As System.Type)
If parent Is Nothing Then
Exit Sub
End If
If parent.GetType Is ctrlType Then
list.Add(parent)
End If
For Each child As Control In parent.Controls
FindControlRecursive(list, child, ctrlType)
Next
End Sub
Private Sub RichTextBoxYukle(ByVal Panel As Object)
FindControlRecursive(_controls, Me, GetType(RichTextBox))
Dim adet As Integer = _controls.Count
If adet = 0 Then
With defaultText
.Dock = System.Windows.Forms.DockStyle.Fill
.Location = New System.Drawing.Point(0, 0)
.Multiline = True
.Name = isim + "1"
.TabIndex = 0
.Tag = 1
End With
Panel.Controls.Add(defaultText)
Else
With defaultText
.Dock = System.Windows.Forms.DockStyle.Fill
.Location = New System.Drawing.Point(0, 0)
.Multiline = True
.Name = isim + (adet + 1).ToString
.TabIndex = 1 + adet
.Tag = 1 + adet
End With
Panel.Controls.Add(defaultText)
End If
_controls.Clear()
End Sub
Private Sub orion_Load(sender As Object, e As EventArgs) Handles Me.Load
SC.Panel1MinSize = (Me.AnaPanel.Size.Width / 2) - 2
SC.Panel2MinSize = (Me.AnaPanel.Size.Width / 2) - 2
RichTextBoxYukle(SC.Panel1)
RichTextBoxYukle(SC.Panel2)
End Sub