Hi,
I have a TabControl on my form with 1 TextBox in EACH Tab, total 2 TextBox...
I fill each TextBox during a loop like this:
However, I need to scroll down both TextBox in each Tab and have to use this code:
However, the problem is that it only works for the SELECTED TAB, no matter which tab is selected.
I do believe, this is because Windows Forms only shows one control at a time, and just update that...
I was hoping this code solved my problem but it didn't:
Can anyone help me please?!
I have a TabControl on my form with 1 TextBox in EACH Tab, total 2 TextBox...
I fill each TextBox during a loop like this:
Visual Basic:
For i As Integer = 1 To 100
ReportTextBoxX1.Text = ReportTextBoxX1.Text + i.ToString + vbNewLine
ReportTextBoxX2.Text = ReportTextBoxX2.Text + i.ToString + vbNewLine
Next
Visual Basic:
Private Sub ReportTextBoxX1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReportTextBoxX1.TextChanged
ReportTextBoxX1.SelectionLength = 0
ReportTextBoxX1.SelectionStart = ReportTextBoxX1.Text.Length
ReportTextBoxX1.ScrollToCaret()
End Sub
Private Sub ReportTextBoxX2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReportTextBoxX2.TextChanged
ReportTextBoxX2.SelectionLength = 0
ReportTextBoxX2.SelectionStart = ReportTextBoxX2.Text.Length
ReportTextBoxX2.ScrollToCaret()
End Sub
I do believe, this is because Windows Forms only shows one control at a time, and just update that...
I was hoping this code solved my problem but it didn't:
Visual Basic:
...Before adding items to TextBox
If Not ReportTextBoxX1.IsHandleCreated Then
Dim handle As IntPtr = ReportTextBoxX1.Handle
End If
If Not ReportTextBoxX2.IsHandleCreated Then
Dim handle As IntPtr = ReportTextBoxX2.Handle
End If