Computing.Net > Forums > Programming > VB6 - Multiple Forms

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VB6 - Multiple Forms

Reply to Message Icon

Name: Burbble
Date: November 8, 2003 at 18:05:36 Pacific
OS: Windows ME
CPU/Ram: Celeron 600mhz/384 MB
Comment:

Erg.. This is a really simple question, but I can't remember how to do this correctly:

I am trying to create multiple copies of the same form (not MDI, just regular forms), and then alter properties of the form and objects on the form. To get started, I tried this code, with "frmMain" and "frmNew" created:

(In a module:)
Public FormCount As Integer
Public NewForms() As frmNew

(In "frmMain":)
Private Sub Command1_Click()
NewForms(Int(Text1.Text)).Caption = "New Text"
End Sub

Private Sub Command2_Click()
FormCount = FormCount + 1
ReDim NewForms(FormCount - 1)
Set NewForms(FormCount - 1) = New frmNew
NewForms(FormCount - 1).Show
End Sub


This is not the final code, all it's supposed to do it change the caption of one of the forms to make sure it is working properly. However, when I click Command2 to make a few news forms, and then click Command1 to change the caption of one of them (Text1.Text = 0), it returns Error 91: Object variable or With block variable not set.

I know I am probably doing something really simple incorrectly, but I can't remember how to do this the right way (haven't done in a long, long time).

Thanks.

-Burbble



Sponsored Link
Ads by Google

Response Number 1
Name: Burbble
Date: November 9, 2003 at 16:21:48 Pacific
Reply:

Nevermind, I think I've figured it out. I changed it to this:

(In a module:)
Public FormCount As Integer

(In "frmMain":)
Dim NewForms() As New frmNew

Private Sub Command1_Click()
NewForms(Int(Text1.Text)).Caption = "New Text"
End Sub

Private Sub Command2_Click()
FormCount = FormCount + 1
ReDim NewForms(1 to FormCount)
NewForms(FormCount).Show
End Sub


-Burbble


0
Reply to Message Icon

Related Posts

See More


VB common factor ip tracer for net send?



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VB6 - Multiple Forms

VBA Multiple Forms www.computing.net/answers/programming/vba-multiple-forms/4878.html

VB6.0 Help www.computing.net/answers/programming/vb60-help-/5230.html

VB6.0 Help Please... www.computing.net/answers/programming/vb60-help-please/5157.html