Solved

VB.NET - Closing Dialog closes parent form.

Posted on 2007-11-26
1
1,157 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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