Click here to Skip to main content
15,909,645 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: enumerate objects Pin
RJGCarey9-Feb-07 2:55
RJGCarey9-Feb-07 2:55 
GeneralRe: enumerate objects Pin
Christian Graus9-Feb-07 9:51
protectorChristian Graus9-Feb-07 9:51 
Questionvba script to monitor temperature and workgroup Pin
tomboy788-Feb-07 7:08
tomboy788-Feb-07 7:08 
Questioninstance of form Pin
charchabil038-Feb-07 6:35
charchabil038-Feb-07 6:35 
AnswerRe: instance of form Pin
MatrixCoder8-Feb-07 6:41
MatrixCoder8-Feb-07 6:41 
GeneralRe: instance of form Pin
charchabil038-Feb-07 7:11
charchabil038-Feb-07 7:11 
GeneralRe: instance of form Pin
Old John8-Feb-07 15:23
Old John8-Feb-07 15:23 
AnswerRe: instance of form [modified] Pin
TwoFaced8-Feb-07 7:42
TwoFaced8-Feb-07 7:42 
Creating a single instance application just prevents an application from being run more then once. It doesn't prevent a form from being created multiple times. I believe the appropriate way to create a single instance form is the following.
Public Class Form2
    Private Shared m_Singleton As Form2     'Current instance

    'Declared private so a new instance can't be created directly
    Private Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
    End Sub

    'Gets the current instance of the form or passes back a new one
    Shared ReadOnly Property Instance() As Form2
        Get
            If m_Singleton Is Nothing OrElse _
                m_Singleton.IsDisposed OrElse _
                m_Singleton.Disposing Then m_Singleton = New Form2

            Return m_Singleton
        End Get
    End Property
End Class
However, if this is your main form you may need to make a small tweak. The code that gets generated to load your form won't used the shared property Instance. If you get an error and can't figure it out let me know. All I did was double clicked the error and then changed the line it brought me to so that it used the Instance property.
GeneralRe: instance of form Pin
charchabil0310-Feb-07 5:51
charchabil0310-Feb-07 5:51 
GeneralRe: instance of form Pin
TwoFaced10-Feb-07 7:10
TwoFaced10-Feb-07 7:10 
GeneralRe: instance of form Pin
charchabil0310-Feb-07 21:16
charchabil0310-Feb-07 21:16 
QuestionClosing a form Pin
jady848-Feb-07 5:51
jady848-Feb-07 5:51 
AnswerRe: Closing a form Pin
M-Hall8-Feb-07 6:21
M-Hall8-Feb-07 6:21 
Questionitem with same key has already been adding Pin
charchabil038-Feb-07 5:32
charchabil038-Feb-07 5:32 
AnswerRe: item with same key has already been adding Pin
Christian Graus8-Feb-07 9:04
protectorChristian Graus8-Feb-07 9:04 
GeneralRe: item with same key has already been adding Pin
charchabil0310-Feb-07 9:43
charchabil0310-Feb-07 9:43 
GeneralRe: item with same key has already been adding Pin
Christian Graus10-Feb-07 10:35
protectorChristian Graus10-Feb-07 10:35 
GeneralRe: item with same key has already been adding Pin
charchabil0310-Feb-07 21:26
charchabil0310-Feb-07 21:26 
QuestionStrong name question or security in general Pin
bpcto8-Feb-07 5:26
bpcto8-Feb-07 5:26 
AnswerRe: Strong name question or security in general Pin
M-Hall8-Feb-07 10:43
M-Hall8-Feb-07 10:43 
QuestionData Report of vb 6 Not refresh help required Pin
amjad ali shah8-Feb-07 5:16
amjad ali shah8-Feb-07 5:16 
QuestionPrinting Question for the Pro's Pin
vbbeg8-Feb-07 5:11
vbbeg8-Feb-07 5:11 
QuestionHow can i change the color of the scrollbar in listview? Pin
dyh22228-Feb-07 4:58
dyh22228-Feb-07 4:58 
QuestionDeployment of VB.NET Program Pin
RichFeldman8-Feb-07 4:17
RichFeldman8-Feb-07 4:17 
AnswerRe: Deployment of VB.NET Program Pin
Colin Angus Mackay8-Feb-07 4:48
Colin Angus Mackay8-Feb-07 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.