Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to reference fields on a TabControl's page
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00851571
Message ID:
00853916
Views:
15
Richard,

That is correct in the fact that all the controls are at the form level for access, different than VFP.

>Cathy,
>Thank you.
>Sorry for the delayed response.
>I was surprised by how VB does that...
>If I understand correctly, all the controls on a form can be referenced by
>Me.Control_Name
>
>If I understand correctly, that implies that if you place controls inside of containers, they still need unique names.
>
>My background is in VFP and in VFP the controls can be accessed in a tree fashion...
>Form1 contains Button1, Container1, and Container2
>Container1 contains Button1
>Container2 contains Button1
>to access them from the form level you would say
>Button1 - for the control not in Container1 or Container2
>Container1.Button1 - for the control in Container1
>Container2.Button1 - for the control in Container2
>
>Thank you...not it's time to move on to the next puzzle...
>Rick
>
>
>>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.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Reply
Map
View

Click here to load this message in the networking platform