• Welcome to Valhalla Legends Archive.
 

Loading more than one instance of a form

Started by phvckmeh, October 01, 2004, 02:04 AM

Previous topic - Next topic

phvckmeh

in vb6:
how to i load more than one instance of a form such as would enable me to do "whisper windows?"

Networks

This should be in the vb6 form.


set frmTest = new frmMain
frmTest.show


I think? I can't really remember + I don't have a vb6 open =\

Grok

You are correct.  To make it better, he might want named whisper windows.  Try this code for starters.


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



LivedKrad

I think it's quite amazing how VB gets around itself not being an OOPL.

Grok

Quote from: LivedKrad on October 01, 2004, 12:08 PM
I think it's quite amazing how VB gets around itself not being an OOPL.

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.

Kp

Quote from: Grok on October 01, 2004, 12:27 PMAnd, this whole thread should be in VB programming.

Done.  On a marginally related note, could someone change phvckmeh's personal text to be something other than "Moderator"?  It looks weird, at best.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!