how to addin a user-defined form

how to addin a user-defined form

Anonymous
Not applicable
358 Views
2 Replies
Message 1 of 3

how to addin a user-defined form

Anonymous
Not applicable
I have successfully addin a icon in Inventor 7, and I define a form. I want
to click the icon to run the form. When I click the icon, there is a error
that undefined object or with block.
My code is:

Option Explicit
Implements ApplicationAddInServer
Public oApp As Inventor.Application
Public WithEvents oButtonHandler1 As ButtonDefinitionHandler


......

Private Sub oButtonHandler1_OnClick()
'my defined form

Dia_Pbom.Show

End Sub
0 Likes
359 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
You might need to create the form as a new form first before showing it:

dim aForm as new Form1

aForm.show

Hope this helps, can't remember whether you need the "new" statement or not,
but from memory this should work.


"zhao ting" wrote in message
news:968700A9402FF67DF5704EA90BDD843E@in.WebX.maYIadrTaRb...
> I have successfully addin a icon in Inventor 7, and I define a form. I
want
> to click the icon to run the form. When I click the icon, there is a error
> that undefined object or with block.
> My code is:
>
> Option Explicit
> Implements ApplicationAddInServer
> Public oApp As Inventor.Application
> Public WithEvents oButtonHandler1 As ButtonDefinitionHandler
>
>
> ......
>
> Private Sub oButtonHandler1_OnClick()
> 'my defined form
>
> Dia_Pbom.Show
>
> End Sub
>
>
0 Likes
Message 3 of 3

Anonymous
Not applicable
J Smith
I am a novice in VB, thank you for your help!
Now I can do the initialization of the form1 in my class module. As follow
code.

Public Sub oButtonHandler1_OnClick()


form1.daihao = oApp.ActiveDocument.PropertySets.Item(3).Item("Part
Number").Value
form1.xinghao =
oApp.ActiveDocument.PropertySets.Item(1).Item("Keywords").Value
form1.mingcheng =
oApp.ActiveDocument.PropertySets.Item(3).Item("Description").Value

form1.Show

End Sub
There is the error if I click command1 button, even though I do it as your
advice.

zhao ting

"" ????
news:1E8A00A3B115A5F823C336F4D79B18D2@in.WebX.maYIadrTaRb...
> You might need to create the form as a new form first before showing it:
>
> dim aForm as new Form1
>
> aForm.show
>
> Hope this helps, can't remember whether you need the "new" statement or
not,
> but from memory this should work.
>
>
> "zhao ting" wrote in message
> news:968700A9402FF67DF5704EA90BDD843E@in.WebX.maYIadrTaRb...
> > I have successfully addin a icon in Inventor 7, and I define a form. I
> want
> > to click the icon to run the form. When I click the icon, there is a
error
> > that undefined object or with block.
> > My code is:
> >
> > Option Explicit
> > Implements ApplicationAddInServer
> > Public oApp As Inventor.Application
> > Public WithEvents oButtonHandler1 As ButtonDefinitionHandler
> >
> >
> > ......
> >
> > Private Sub oButtonHandler1_OnClick()
> > 'my defined form
> >
> > Dia_Pbom.Show
> >
> > End Sub
> >
> >
>
>
0 Likes