Click here to Skip to main content
15,891,717 members
Home / Discussions / Visual Basic
   

Visual Basic

 
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 
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 
Sorry, I should have mentioned how to use it also. The 'Sub New' was declared private so you can't create a new instance of the form. If you could create a new instance then you would be able to create multiple instances, which would defeat the purpose of a singleton form.

The proper way to access the form is through the shared property 'instance'. So to show the form you would just use
frmCollectAlarms.Instance.Show
If you create a variable to point to the form you would use
dim frm as frmCollectAlarms = frmCollectAlarms.Instance
However, that method isn't necessary and kind of goes around the idea of a singleton form. The reason is that you could technically have more then one frmCollectAlarms in memory, however, only one would be usefull while the others would be disposed.

One thing I learned is that the method I used isn't thread safe. I did a little research after I posted the code just to make sure I hadn't steered you wrong. If you plan on accessing the form from multiple threads then you should do a little research on creating a thread safe singleton form. However, if you don't plan on accessing it from multiple threads then I wouldn't worry about it. Although looking up singleton forms may be a good idea anyway just for future knowledge. Especially 'thread safe' singleton forms.
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 
GeneralRe: Deployment of VB.NET Program Pin
RichFeldman8-Feb-07 5:01
RichFeldman8-Feb-07 5:01 
AnswerRe: Deployment of VB.NET Program Pin
Dave Kreskowiak8-Feb-07 4:51
mveDave Kreskowiak8-Feb-07 4:51 

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.