CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Posts
    265

    Button Second Click

    Hi,

    I have a User Control that contains a Button. This button works for the first click. But the Click Event is not fired in the second click. Please help.

    Here's my code:

    Code:
    Public Sub New()
            MyBase.New()
            ' This call is required by the Windows Form Designer.
            InitializeComponent()
    
            ' Add any initialization after the InitializeComponent() call.
            Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            AddHandler doc.CommandEnded, AddressOf Me.plineCommandEnded
        End Sub
    
    Private Sub ucTools_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
            Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            RemoveHandler doc.CommandEnded, AddressOf Me.plineCommandEnded
        End Sub
    
    Private Sub btnSpace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSpace.Click
            InitializeComponent()
            Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            CmdStarted = True
            doc.SendStringToExecute("_PLINE" & vbCr, True, False, True)
    End Sub
    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Button Second Click

    You don't close anything, so everything appears open
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2004
    Posts
    265

    Re: Button Second Click

    I commented out InitializeComponent() and everything works fine.

    Thanks

  4. #4
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Button Second Click

    Mark your thread resolved please.

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

Featured