Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > General Discussion
  New Posts New Posts RSS Feed - Multiple Instances of Child Form on Tabs
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Multiple Instances of Child Form on Tabs

 Post Reply Post Reply
Author
Message
wrhaynes View Drop Down
Newbie
Newbie


Joined: 08 December 2007
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote wrhaynes Quote  Post ReplyReply Direct Link To This Post Topic: Multiple Instances of Child Form on Tabs
    Posted: 08 December 2007 at 1:10am
Hello.  I am using the TabControl within VB6 to allow the user to enter multiple instances an entity for a record.  I created a form which contains the controls to collect data about each instance of the entity, and I use the code below to create new tab items so that the user can enter details for each instance of the entity.
 
'Create new instance of entity on form

    Dim strTabCaption As String
    Dim iEntityNum As Integer
   
    If iTabCount = 0 Then    'a public counter
        TabControl.Visible = True
        Set pageEntityInfo = New pageEntityInfo
        TabControl.InsertItem 0, "Entity 1", pageEntityInfo.hwnd, 1
        iTabCount = 1
    Else
        iEntityNum = iTabCount + 1
        strTabCaption = "Entity " & iEntityNum
        Set pageEntityInfo = New pageEntityInfo
        TabControl.InsertItem iTabCount, strTabCaption, pageEntityInfo.hwnd, 1
        iTabCount = iTabCount + 1
    End If

My question is...once the user finishes entering data on each tab (instance of pageEntityInfo) and saves the parent record, I want to save the parent record details and then loop through the tabs (iTabCount) and save the details for each Entity instance (ParentRecordID, EntityNum, EntityName, EntityType...).  How can I collect data from the controls on each instance of pageEntityInfo per tab (i.e. how do I specify that I want the data from pageEntityInfo on TabControl(i))?
 
I know that I could create pageEntityInfo1, pageEntityInfo2, etc. and limit the number of Entity instances the user can add for each parent record, but I would prefer to re-use one form (pageEntityInfo) and allow the user to enter 'n' instances.
 
Thanks for your help!
 
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 08 December 2007 at 2:40am
Think you have add Array variable and add all forms to it.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
wrhaynes View Drop Down
Newbie
Newbie


Joined: 08 December 2007
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote wrhaynes Quote  Post ReplyReply Direct Link To This Post Posted: 08 December 2007 at 11:15am
Thanks, Oleg.  I'll try that.
Back to Top
Baldur View Drop Down
Senior Member
Senior Member


Joined: 22 November 2006
Location: Germany
Status: Offline
Points: 244
Post Options Post Options   Thanks (0) Thanks(0)   Quote Baldur Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2007 at 2:50pm
I think, pageEntityInfo is a form-object.
You can do this:
 
dim xForm as Form
 
for each xForm in Forms
   if typeof xForm is pageEntityInfo then
      ' do anything
   endif
next
Back to Top
wrhaynes View Drop Down
Newbie
Newbie


Joined: 08 December 2007
Location: United States
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote wrhaynes Quote  Post ReplyReply Direct Link To This Post Posted: 20 December 2007 at 9:23pm

Thanks for the reply, Baldur.  That will work since I don't need to know which instance of the form I am on...I am saving the data on each instance.

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.