home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,714 of 10,840   
   Otie to eschuylerTAKE@THISadelphiaOUT.net   
   Re: Child forms and operation - non-MDI   
   28 Oct 05 10:55:49   
   
   XPost: comp.lang.basic.visual   
   From: otie_nospam@adelphia.net   
      
   Yes, thank you so much.   
      
   I see I have one other problem. If I want to keep the data that   
   appears in the grids separate for each form and grid (because new   
   forms will have different calculated data in the grids), I will have   
   to keep track of the separate data in separate arrays (or at least use   
   a 2-dimension array instead of the 1-dimension array I now have). This   
   being the case, I wonder if it just isn't as easy to actually create   
   10 different grids forms and just call them separately. Yes, putting   
   everything into arrays is perhaps cleaner, but making 10 different   
   forms all identical except for the titles and what data is loaded from   
   which array seems easy enough, too. Maybe it's a toss up. I suppose   
   good programming practice is to make form arrays and dimension data   
   arrays that correspond to these form arrays.   
      
   Thanks again.   
      
      
      
   --   
      
      
   ---   
   Otis   
      
      
      
    wrote in message   
   news:u_qdnag4hJkTs__eRVn-vA@adelphia.com...   
   > "Otie"  wrote:   
   > >   
   > >I have a project with a main form and a second form with a grid on   
   it.   
   > >Neither form is an MDI, thus neither form is a child - they are two   
   > >   
   > >I'm guessing I either need to make an MDI form and use the CHILD   
   > >property - or can I just open new instances of the current form   
   > >without messing with any sort of MDI?   
   > >   
   > >Thank you.   
   >   
   > Otis,   
   >   
   > You can go with the "new instances of the current form without   
   messing with   
   > any sort of MDI" route as in this simple example.   
   >   
   > 1. Create a project with two forms: Form1 and Form2.   
   > 2. Put a button on Form1 named cmdForm2.   
   > 3. Put a textbox on Form2 named txtFormNum.   
   > 4. Put the following code into Form1:   
   >   
   > Option Explicit   
   >   
   > Dim Forms(10) As Form   
   >   
   > Private Sub cmdForm2_Click()   
   >    Static FormNum As Long   
   >   
   >    If FormNum < 10 Then   
   >    ' create/show new form   
   >       FormNum = FormNum + 1   
   >   
   >       Set Forms(FormNum) = New Form2   
   >       With Forms(FormNum)   
   >          .txtFormNum.Text = "Form #" & CStr(FormNum)   
   >          .Show   
   >       End With   
   >    End If   
   > End Sub   
   >   
   > Private Sub Form_Unload(Cancel As Integer)   
   >    Dim VForm As Variant   
   >   
   >    For Each VForm In Forms   
   >       If Not VForm Is Nothing Then   
   >          Unload VForm   
   >          Set VForm = Nothing   
   >       End If   
   >    Next   
   > End Sub   
   >   
   > 5. Run the project. You will get a new instance of Form2 each time   
   you   
   > press the button on Form1.   
   > Each instance of Form2 has a different form number in the textbox.   
   > This shows that you can put different data into each one.   
   >   
   > 6. Close Form1. Notice that all of the instances of Form2 are   
   unloaded and   
   > the program ends.   
   >   
   > Hope this helps,   
   > Eric   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca