Trouble With Form Display...

580
2
05-19-2010 10:40 PM
RobertKoch
New Contributor
Hi,

I am having trouble doing something which I would have thought to be pretty straight forward.

I have a form (frmUpdate) which I cannot get to display. I want the form to show when the user selects a particular item from a custom menu.

I can get a msgbox to display when the user clicks on the menu item, but the subsequent call to show the form does nothing.

Any thoughts? I am using VB.Net, VS2008, ArcMap 9.3.1

Public Overrides Sub OnClick()

        MsgBox("ping!") ' this is working so I know the code is getting this far

        'Dim form As frmUpdate = New frmUpdate() ' tried this and it didn't work 
        Dim form As frmUpdate
        form = New frmUpdate()
        form.Show()             ' nothing happens

End Sub

Regards. Rob.
0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
The code is correct.  You don't have any error handling here so if an error is occurring you won't know it.  Have you tried stepping through the code with the debugger?  If your form class has code inside of New() or code inside one of the events that fire when the form is displayed (ie, Load, Activate, etc.) then an error could be thrown there.  If so, that would prevent the form from being shown because the code would stop executing before the call to Show().  The problem is most likely in your form class, not the code you posted here.
0 Kudos
RobertKoch
New Contributor
Hi Neil,

Thanks for your reply. Good to know that my code calling the form was correct. You were right - there was something wrong with my form class. Couldn't put my finger on exactly what was causing it, but when I deleted the form and recreated it everything worked fine.

Thanks again for our help.

Regards. Rob.
0 Kudos