Print Page | Close Window

Multiple Instances of Child Form on Tabs

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Active-X COM Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=9043
Printed Date: 21 November 2024 at 11:16pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Multiple Instances of Child Form on Tabs
Posted By: wrhaynes
Subject: Multiple Instances of Child Form on Tabs
Date 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!
 



Replies:
Posted By: Oleg
Date 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


Posted By: wrhaynes
Date Posted: 08 December 2007 at 11:15am
Thanks, Oleg.  I'll try that.


Posted By: Baldur
Date 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


Posted By: wrhaynes
Date 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.




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net