Results 1 to 5 of 5

Thread: [2005] Form dissapearing issue

  1. #1

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    [2005] Form dissapearing issue

    This is my problem:

    I have an add-in button for Outlook 2003 added on standard bar in main Outlook form and also in new message form. The button click event shows a form. When the button is clicked from the new message Outlook window the form shows only for a quick time then dissapears. I could only catch the form.Shown event and thats all. How can I make the form stay opened?


    thank you
    Home is where your Head is

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Re: [2005] Form dissapearing issue

    Can you post the code you are using to open your form please?

    Also (if the above isn't at fault), have you tried setting breakpoints on your methods and stepping through them, perhaps your code is closing the form somehow?

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: [2005] Form dissapearing issue

    I tried to debug with breakpoints but didnt help. The constructor is called successfully, then the shown event is fired and after this the form dissapears but the code goes on normally.
    Home is where your Head is

  4. #4

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: [2005] Form dissapearing issue

    Code:
     Private Sub btn2_Click(ByVal Ctrl As Office.CommandBarButton, ByRef CancelDefault As Boolean)
         Try
             Dim t As New System.Threading.Thread(New System.Threading.ThreadStart(ThreadProc))
            
             t.Start()
         Catch ex As Exception
             _eventlog.WriteEntry(ex.Message + "" & Chr(10) & "" + ex.StackTrace, EventLogEntryType.[Error])
         End Try
     End Sub
    
     Public Sub ThreadProc()
         Try
             Dim ttf As TTForm = Nothing
            
             ttf = New TTForm(System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString, _eventlog)
             ttf.outlookApplication = explorer.Application
             ttf.Show()
             ttf.Visible = True
             AddHandler ttf.Shown, AddressOf ttf_Shown
             AddHandler ttf.Disposed, AddressOf ttf_Disposed
             AddHandler ttf.VisibleChanged, AddressOf ttf_VisibleChanged
             AddHandler ttf.FormClosed, AddressOf ttf_FormClosed
                
             MessageBox.Show("Click") ' if this line is removed the form is not visible at all!
         Catch ex As Exception
             _eventlog.WriteEntry(ex.ToString())
         End Try
     End Sub
    Home is where your Head is

  5. #5

    Thread Starter
    Addicted Member dani2's Avatar
    Join Date
    Feb 2005
    Location
    Sibiu.ro
    Posts
    191

    Re: [2005] Form dissapearing issue

    I think it has to do with threading and ownership but i dont know exactly where to start. Any help is very appreciated.
    Home is where your Head is

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