I've hit a roadblock and really need help with looping through tabconrol's tabpage's, getting each tabpage's parent name and richtextbox control's text value. I have a ctabcontrol that has ctabpage tabpages, which also have Usercontrol's on the body of each tab. I developed a FindAll to search through each openned tabpage's richtextbox in the mdi parent container form. However, I cannot get the for loop to produce any values for the controls. All values are 0. The richtextbox.text value is empty. I even tried to produce a value with TabControlCollection to no avail, it shows 0 tabs in the collection even though I have 3 tabs open in the mdi parent container. How can I get the actual controls and values from other tabs so I can evaluate them in my Find tabpage functons?
Code:Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim tabCtrl As New cTabControl Dim frmMain As New frmMain Dim x As New Integer x = frmMain.tabCtrl.TabCount wordToFind = Trim(tbwordtofind.Text.ToString) Occurences = 0 ' NOTE: The tabCtrl is not getting the TabPages or TabPageCollection to populate values Dim TabCollection As TabControl.TabPageCollection = tabCtrl.TabPages ' Check if an entry is in the Find textbox or if it is empty If FindForm_Validation() = True Then Dim Pdf As New Pdf Dim Pdfrtb As RichTextBox = Pdf.RichTextBox1 ' Use the richtextbox's find feature for the form currently in focus (being used) If wordToFind.Length > 0 Then tbOccurenceCount.Text = Me.FindAll(0, wordToFind, Pdfrtb) End If ' If the Text Form is open Dim Taxonomy As New Taxonomy Dim Taxrtb As RichTextBox = Taxonomy.RichTextBox1 ' Do the same for the text form if it is open (focused) If wordToFind.Length > 0 Then tbOccurenceCount.Text = Me.FindAll(0, wordToFind, Taxrtb) End If ' If the Text Form is open Dim Text As New Text Dim Textrtb As RichTextBox = Text.RichTextBox1 ' Do the same for the text form if it is open (focused) If wordToFind.Length > 0 Then tbOccurenceCount.Text = Me.FindAll(0, wordToFind, Textrtb) End If End If End Sub




Reply With Quote
