HELP!!! How to change a form's name at runtime in VB6???

Flixxan
04-14-2003, 09:59 AM
Forms in VB6

I have a set of design-time-defined forms and during runtime I need to call each of these forms and insert them into an array of forms.
For example:

I have a design-time-defined form called frmMyForm.
During its Load event I need to rename the form from
frmMyForm to Form(Index) where Index is the form's index in a form array.

Does anybody know how to do this?

I believe there is a syntax that looks something like this:

frmMyForm Is Now Form(Index)

but this doesn't work.

OnErr0r
04-14-2003, 10:03 AM
Set Form(Index) = frmMyForm

Squirm
04-14-2003, 10:06 AM
I'm having trouble working out what you want to do and why.
You can add a form to an array:

Set FormArray(Index) = frmMyForm

Then it can be accessed using FormArray(Index) whenever required. Or you can use a collection and provide each form with a key. There is already a default Forms collection which all forms are stored in automatically.

ntsa
06-17-2003, 10:53 AM
Option Explicit

Dim FormArray()
Dim ChIndex

Private Sub UserList_DblClick()

Static ld As Boolean

If Not ld Then
ChIndex = 0
ld = True
End If

ReDim Preserve FormArray(ChIndex)

Set FormArray(ChIndex) = New frmChat
With FormArray(ChIndex)
.Show
.Caption = "Chat with " & UserList.SelectedItem
.ChatWith = UserList.SelectedItem
End With

ChIndex = ChIndex + 1

End Sub

Twan
06-17-2003, 10:57 AM
Option Explicit

Dim FormArray()
Dim ChIndex

Private Sub UserList_DblClick()

Static ld As Boolean

If Not ld Then
ChIndex = 0
ld = True
End If

ReDim Preserve FormArray(ChIndex)

Set FormArray(ChIndex) = New frmChat
With FormArray(ChIndex)
.Show
.Caption = "Chat with " & UserList.SelectedItem
.ChatWith = UserList.SelectedItem
End With

ChIndex = ChIndex + 1

End Sub


Why are you dimming FormArray as a variant?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum