Hi Richard,
You don't need to tree down to get at the control you want. All the controls are referenced at the Forms level. If you open up the code associated with your Form and look in the "#Region " Windows Form Designer generated code " you will see all the controls contained in the Form.
>I need to find out how to access/reference fields on a TabControl's page
>
>Here's a description of what I have and how far I've gotten...
>
>I have a form
>The form is named
frmOmnia_Act_Top>The form has two halves
>The top half has a variety of fields on it, like
txtCompany>The bottom half of the form is my Tab Control which is named
tcBottom.
>This has several pages on it. One of the pages is named
tpUserFields.
>tpUserFields has a field on it named
txtRep>
>In my form's load I connect to my data, and call a procdure I call
>
ShowRecord(intCurrentRecord)>
>In ShowRecord I initialize my fields as follows
>
txtCompany.Text = dstOmnia_Act.Tables(0).Rows(intCurrentRecord).Item("Company")>
>I can now initialize the fields on the Tab Control as follows
>
Me.Controls.Item(2).Controls.Item(3).Controls.Item(8).Text = dstOmnia_Act.Table(0).Rows(intCurrentRecord).Item("Rep")>
>While this works, it's not maintainable...and it's confusing.
>The only way I got this far was via the debugger...
>
>BTW - the "Rep" field is the first field on the tab page.
>There's a
txtComments field also...It's the last field on the page
>to reference the "Comments" field I would have to use the following line
>
Me.Controls.Item(2).Controls.Item(3).Controls.Item(1).Text = dstOmnia_Act.Table(0).Rows(intCurrentRecord).Item("Comments")>
>I know there's a better way than what I've stumbled upon.
>
How am I supposed to reference these fields?>
>TIA
>
>Rick
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi