all groups > vb.net upgrade > november 2003 >
You're in the

vb.net upgrade

group:

Multiple instances problem


Multiple instances problem Jonathan Boivin
11/27/2003 6:37:44 PM
vb.net upgrade:
Hi !

In VB6 I managed how to load multiple instances of the same form. (I built
an agenda which I need to load multiple times)

Unfortunately, I can't figure out how to get it working on VB.NET.

Is there someone which could help ?

Thanks
Jo

Re: Multiple instances problem hirf-spam-me-here NO[at]SPAM gmx.at
11/28/2003 8:09:52 AM
* "Jonathan Boivin" <djon2003@hotmail.com> scripsit:
[quoted text, click to view]

\\\
Dim f As New AgendaForm()
f.Show()
///

--
Herfried K. Wagner [MVP]
Re: Multiple instances problem Jonathan Boivin
11/29/2003 6:10:11 PM
Hi Herfried !

Thanks for the hint, but I would need to use more than once instance of my
window. In VB6 I was using an array to do so, but I can't define New to an
array in VB.NET

How could I do so ? Do you have an idea ?

Thanks in advance.

Jonathan


"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> a écrit dans le
message de news:bq6svo$1vb1p6$1@ID-208219.news.uni-berlin.de...
[quoted text, click to view]

Re: Multiple instances problem hirf-spam-me-here NO[at]SPAM gmx.at
11/30/2003 2:32:02 AM
* "Jonathan Boivin" <djon2003@hotmail.com> scripsit:
[quoted text, click to view]

How did you do that in VB6?!

--
Herfried K. Wagner [MVP]
VB6 Exemple Jonathan Boivin
12/1/2003 9:39:55 AM
Hi !

Here's the code :

In a module :

Public AgendaVar() As AgendaType 'THIS IS FOR THE SPECIAL PROPERTIES OF EACH
Agenda.
Public Agendas() As New Agenda
Public Type AgendaType
Free As Boolean
End Type

Public Function FindFreeAgenda() As Integer
ArrayCount = UBound(Agendas)

For i = 1 To ArrayCount
If AgendaVar(i).Free Then
FindFreeAgenda = i
AgendaVar(i).Free = False
Exit Function
End If
Next

ReDim Preserve Agendas(ArrayCount + 1)
ReDim Preserve AgendaVar(ArrayCount + 1)
AgendaVar(ArrayCount + 1).Free = False
FindFreeAgenda = UBound(AgendaVar)
End Function

In a form to add a new Agenda :

fIndex = FindFreeAgenda()
Agendas(fIndex).Tag = fIndex
AgendaVar(fIndex).Free = False

When the Agenda Form is closing :
AgendaVar(Me.Tag).Free = True

And after than I could use like Agendas(fIndex).Caption (Which is now .Text
in VB.NET) to change the window title of each one etc.

I think that I would have to do this VIA a collection, but I am not quite
sure.
Thanks to look at my problem !

Jonathan

"Jonathan Boivin" <djon2003@hotmail.com> a écrit dans le message de
news:%23I80$9TtDHA.2388@TK2MSFTNGP12.phx.gbl...
[quoted text, click to view]

Re: Multiple instances problem Jonathan Boivin
12/2/2003 7:43:33 AM
Did you find something ???

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> a écrit dans le
message de news:eJkGhHutDHA.2224@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Re: Multiple instances problem hirf-spam-me-here NO[at]SPAM gmx.at
12/2/2003 7:25:43 PM
* "Jonathan Boivin" <djon2003@hotmail.com> scripsit:
[quoted text, click to view]

I don't know what's your problem. You can create as many instances of a
window as you want:

\\\
Dim f As New FooForm()
f.Show()
///

--
Herfried K. Wagner [MVP]
Re: Multiple instances problem Jonathan Boivin
12/3/2003 12:22:31 PM
Thanks ! I think I figured it out.

Jonathan

"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> a écrit dans le
message news: bqillp$23p37r$3@ID-208219.news.uni-berlin.de...
[quoted text, click to view]

AddThis Social Bookmark Button