|
-
Apr 23rd, 2008, 03:38 AM
#1
Thread Starter
Addicted Member
[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
-
Apr 23rd, 2008, 03:59 AM
#2
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?
-
Apr 23rd, 2008, 04:02 AM
#3
Thread Starter
Addicted Member
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
-
Apr 23rd, 2008, 04:08 AM
#4
Thread Starter
Addicted Member
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
-
Apr 23rd, 2008, 06:16 AM
#5
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|