Results 1 to 2 of 2

Thread: [RESOLVED] DialogResult Problem

  1. #1

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Resolved [RESOLVED] DialogResult Problem

    Hi all,
    im having a problem using the dialogresult. I have 2 forms, frm1 and frm2. frm1 is the main form and frm is another window that will popup and ask the user to save. So when the user hits the back button it will return dialogresult to frm1.

    here is the code:

    Frm1
    VB Code:
    1. Dim l_result As DialogResult
    2. l_result = l_frm2.ShowDialog(Me)
    3. 'here l_result is always DialogResult.None

    Frm2
    VB Code:
    1. Private Sub btBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btBack.Click
    2.         If m_settings Is Nothing Then
    3.             DialogResult = DialogResult.Cancel
    4.         Else
    5.             DialogResult = DialogResult.OK
    6.         End If
    7.         If m_Saved = True Then
    8.             Me.Close()
    9.             Me.Dispose()
    10.         Else
    11.             If MsgBox("Exit without saving?", MsgBoxStyle.YesNo, "") = MsgBoxResult.Yes Then
    12.                 Me.Close()
    13.                 Me.Dispose()
    14.             End If
    15.         End If
    16.     End Sub

    is the me.dispose causing the problem??
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

  2. #2

    Thread Starter
    Fanatic Member Strider's Avatar
    Join Date
    Sep 2004
    Location
    Dublin, Ireland
    Posts
    612

    Re: DialogResult Problem

    its because i had set in the form closing event e.cancel = true
    Barry


    Visual Studio .NET 2008/Visual Studio .NET 2005/Visual Studio .NET 2003
    .NET Framework 3.0 2.0 1.1/ASP.Net 3.0 2.0 1.1/Compact Framework 1.0

    SQL Server 2005/2000/SQL Server CE 2.0


    If you like, rate this post

    Compact Framework for Beginners

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width