Solved

VB.NET - Closing Dialog closes parent form.

Posted on 2007-11-26
1
1,152 Views
Last Modified: 2010-08-05
I am developing a Windows Mobile 5.0 application using VB.NET in VS2005.

I have an issue with dialogs. I have an inital form (InvocieEntryForm) and from it I show a dialog form to select a product (ProductSelectForm).

When I return from the dialog, the ProductSelectForm is not visible. WHat is visible is the parent of the ProductSelectForm. It does not appear that the ProductSelectForm is really being closed as the 'Closing' and 'Closed' events are not fired.

SHown below id how I call the dialog. Its nothing special.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLookup.Click

        Dim p As New ProductSelectForm()

        If (p.ShowDialog() = Windows.Forms.DialogResult.OK) Then

            tbUPC.Text = p.prod.GetUPC()

        End If
 

    End Sub

Open in new window

0
Comment
Question by:lachmann
1 Comment
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 500 total points
ID: 20351345
try to do this:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLookup.Click
        Dim p As New ProductSelectForm()
        If (p.ShowDialog() = Windows.Forms.DialogResult.OK) Then
            tbUPC.Text = p.prod.GetUPC()
        End If
        Me.Select()
End Sub
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now