Valhalla Legends Forums Archive | Visual Basic Programming | Loading more than one instance of a form

AuthorMessageTime
phvckmeh
in vb6:
how to i load more than one instance of a form such as would enable me to do "whisper windows?"
October 1, 2004, 7:04 AM
Networks
This should be in the vb6 form.

[code]
set frmTest = new frmMain
frmTest.show
[/code]

I think? I can't really remember + I don't have a vb6 open =\
October 1, 2004, 1:58 PM
Grok
You are correct.  To make it better, he might want named whisper windows.  Try this code for starters.

[code]
Option Explicit

Private Function FindWhisperWindow(ByVal WhisperName As String) As frmWhisper
    Dim F1 As Form
    For Each F1 In VB.Forms
        If F1.Tag = "WhisperWindow for " & WhisperName Then
            'target window found
            Set FindWhisperWindow = F1
        End If
    Next
    If FindWhisperWindow Is Nothing Then
        'did not find, need to create a new window and make it visible
        Set FindWhisperWindow = New frmWhisper
        FindWhisperWindow.Tag = "WhisperWindow for " & WhisperName
        FindWhisperWindow.Show
    End If
End Function

Private Sub Command1_Click()
    Dim WW As frmWhisper
    Set WW = FindWhisperWindow(Text1.Text)
    WW.AddChat vbWhite, "<From [vL]Grok:  This should work now>"
End Sub
[/code]

October 1, 2004, 5:04 PM
LivedKrad
I think it's quite amazing how VB gets around itself not being an OOPL.
October 1, 2004, 5:08 PM
Grok
[quote author=LivedKrad link=topic=8960.msg82844#msg82844 date=1096650522]
I think it's quite amazing how VB gets around itself not being an OOPL.
[/quote]

Realize that while VB6 may not have fully-implemented OOP features, it does have some.  Missing is inheritance and polymorphism, but VB6 is an object-BASED language, if that helps you understand.

VB.NET meanwhile, is fully OOP compliant, afaik.  MyndFyre has more experience with VB.NET and could clarify.  However, our two replies are off-topic for this forum.

And, this whole thread should be in VB programming.
October 1, 2004, 5:27 PM
Kp
[quote author=Grok link=topic=8960.msg82845#msg82845 date=1096651642]And, this whole thread should be in VB programming.[/quote]

Done.  On a marginally related note, could someone change phvckmeh's personal text to be something other than "Moderator"?  It looks weird, at best.
October 1, 2004, 10:08 PM

Search