dpatfield66
Well-known member
- Joined
- Apr 6, 2006
- Messages
- 136
- Programming Experience
- 5-10
Ok, here's my issue:
I have a control (frmAdmit.pagAPrenatal)
It's a tabpage on a form.
I have a list box that lists all the pages on whatever form is selected.
For instance, if the user selects Admit from a combobox, then the listview populates with the names of all my pages on the Admit form.
Ex: Prenatal, Prenatal History, Health History, and so forth...
I also have a subitem for each listview item, that contains the actual NAME of the page and not its text.
Ex:
Item(0) SubItem(1)
Prenatal pagAPrenatal
Custom pagACustom
Now, when someone selects Prenatal for example, I want the program to loop through all the controls on the Prenatal page. So, in order to reference Prenatal, my argument has to be frmAdmit.pagAPrenatal.
But pagAPrenatal in my subitem box is a string, and it won't convert to a control (frmAdmit.pagAPrenatal). I've tried everything, what do I do.
My subroutine to do the loop looks like this:
Private Sub lstTabPages_Click()
Call DisplayCBOLabels(lstCBOLabels,frmAdmit.pagAPrenatal)
End Sub
Public Sub DisplayCBOLabels(ByVal objListBox As Object, ByVal ctrlMain As Object)
Dim ctrl As Control
Dim i As Integer = 0
For Each ctrl In ctrlMain.Controls
If ctrl.HasChildren Then DisplayTabPages(objListBox, ctrl)
If TypeOf ctrl Is Label Then
Dim lblLabel As Label = ctrl
objListBox.Items.Insert(i, lblLabel.Text)
i = i + 1
End If
Next
End Sub
But I don't want to physically put in frmAdmit.pagAPrenatal, but rather the value that is stored in my subitem (which is pagAPrenatal, I actually need it to read frmAdmit.pagAPrenatal)
there must be an easy way??
I have a control (frmAdmit.pagAPrenatal)
It's a tabpage on a form.
I have a list box that lists all the pages on whatever form is selected.
For instance, if the user selects Admit from a combobox, then the listview populates with the names of all my pages on the Admit form.
Ex: Prenatal, Prenatal History, Health History, and so forth...
I also have a subitem for each listview item, that contains the actual NAME of the page and not its text.
Ex:
Item(0) SubItem(1)
Prenatal pagAPrenatal
Custom pagACustom
Now, when someone selects Prenatal for example, I want the program to loop through all the controls on the Prenatal page. So, in order to reference Prenatal, my argument has to be frmAdmit.pagAPrenatal.
But pagAPrenatal in my subitem box is a string, and it won't convert to a control (frmAdmit.pagAPrenatal). I've tried everything, what do I do.
My subroutine to do the loop looks like this:
Private Sub lstTabPages_Click()
Call DisplayCBOLabels(lstCBOLabels,frmAdmit.pagAPrenatal)
End Sub
Public Sub DisplayCBOLabels(ByVal objListBox As Object, ByVal ctrlMain As Object)
Dim ctrl As Control
Dim i As Integer = 0
For Each ctrl In ctrlMain.Controls
If ctrl.HasChildren Then DisplayTabPages(objListBox, ctrl)
If TypeOf ctrl Is Label Then
Dim lblLabel As Label = ctrl
objListBox.Items.Insert(i, lblLabel.Text)
i = i + 1
End If
Next
End Sub
But I don't want to physically put in frmAdmit.pagAPrenatal, but rather the value that is stored in my subitem (which is pagAPrenatal, I actually need it to read frmAdmit.pagAPrenatal)
there must be an easy way??