Click here to Skip to main content
15,924,036 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: need help with decimal rounding Pin
ChandraRam14-Dec-06 22:28
ChandraRam14-Dec-06 22:28 
QuestionReading Security Event Log Pin
JadsHari14-Dec-06 20:20
JadsHari14-Dec-06 20:20 
AnswerRe: Reading Security Event Log Pin
Dave Kreskowiak15-Dec-06 4:11
mveDave Kreskowiak15-Dec-06 4:11 
GeneralRe: Reading Security Event Log Pin
JadsHari19-Dec-06 15:14
JadsHari19-Dec-06 15:14 
GeneralRe: Reading Security Event Log Pin
Dave Kreskowiak20-Dec-06 3:14
mveDave Kreskowiak20-Dec-06 3:14 
GeneralRe: Reading Security Event Log Pin
JadsHari26-Dec-06 20:42
JadsHari26-Dec-06 20:42 
Questionform is opened or not in vb.net 2005 Pin
amaneet14-Dec-06 19:55
amaneet14-Dec-06 19:55 
AnswerRe: form is opened or not in vb.net 2005 Pin
Dave Kreskowiak15-Dec-06 4:29
mveDave Kreskowiak15-Dec-06 4:29 
What are you using to trigger the creation of your second form? What are you using to show your form? Are you calling .Show() or are you calling .ShowDialog()??

If you're using .Show, you'll have to keep track of the instance of the form that you created. When you go to attempt to create the second instance of that form, check the variable you're using to track the new form. If it's not Nothing, then you can create a new instance of the form.

The problem comes when the new form closes. You have to listen for the form's FormClosing event so you can track that the form is in the process of closing. You can use this opportunity to retrieve any data you need off of that form before it dies completely.
Public Class Form1
    Private OpenForm As Form2
 
    Private Sub Button1_Click(blah, blah) Handles Button1.Click
        If OpenForm Is Nothing Then
            OpenForm = New Form2
            AddHandler OpenForm.FormClosing, AddressOf OpenForm_FormClosing
            OpenForm.Show()
        End If
    End Sub
 
    Private Sub OpenForm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs)
        RemoveHandler OpenForm.FormClosing, AddressOf OpenForm_FormClosing
        '
        ' Get any data you need from the form here...
        '
        OpenForm = Nothing
    End Sub
End Class





Dave Kreskowiak
Microsoft MVP - Visual Basic


GeneralRe: form is opened or not in vb.net 2005 Pin
codemunkeh15-Dec-06 6:24
codemunkeh15-Dec-06 6:24 
GeneralRe: form is opened or not in vb.net 2005 Pin
Dave Kreskowiak15-Dec-06 6:46
mveDave Kreskowiak15-Dec-06 6:46 
GeneralRe: form is opened or not in vb.net 2005 Pin
amaneet15-Dec-06 21:01
amaneet15-Dec-06 21:01 
Questioncrystal; reports in vb.net Pin
amaneet14-Dec-06 18:45
amaneet14-Dec-06 18:45 
GeneralRe: crystal; reports in vb.net Pin
Paul Conrad24-Dec-07 11:44
professionalPaul Conrad24-Dec-07 11:44 
Questiondeclare an array of structures Pin
Tom Wright14-Dec-06 15:48
Tom Wright14-Dec-06 15:48 
AnswerRe: declare an array of structures Pin
Guffa14-Dec-06 16:17
Guffa14-Dec-06 16:17 
GeneralRe: declare an array of structures Pin
Tom Wright15-Dec-06 7:10
Tom Wright15-Dec-06 7:10 
AnswerRe: declare an array of structures Pin
Dave Kreskowiak14-Dec-06 17:05
mveDave Kreskowiak14-Dec-06 17:05 
GeneralRe: declare an array of structures Pin
Paul Conrad14-Dec-06 18:28
professionalPaul Conrad14-Dec-06 18:28 
QuestionQuestion About Transparency Pin
Bso_Cool14-Dec-06 14:59
Bso_Cool14-Dec-06 14:59 
AnswerRe: Question About Transparency Pin
Amit Kushwaha14-Dec-06 16:53
Amit Kushwaha14-Dec-06 16:53 
GeneralRe: Question About Transparency Pin
Bso_Cool15-Dec-06 9:04
Bso_Cool15-Dec-06 9:04 
QuestionSend mouseclick to specific window Pin
Lennard Fonteijn14-Dec-06 11:26
Lennard Fonteijn14-Dec-06 11:26 
AnswerRe: need help with "OleDbException was unhandled - not a valid password" Pin
Dave Kreskowiak14-Dec-06 10:00
mveDave Kreskowiak14-Dec-06 10:00 
GeneralRe: need help with "OleDbException was unhandled - not a valid password" Pin
vbbeg14-Dec-06 10:54
vbbeg14-Dec-06 10:54 
GeneralRe: need help with "OleDbException was unhandled - not a valid password" Pin
Dave Kreskowiak14-Dec-06 16:57
mveDave Kreskowiak14-Dec-06 16:57 

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.