Inventor API bug?

Inventor API bug?

Anonymous
Not applicable
476 Views
6 Replies
Message 1 of 7

Inventor API bug?

Anonymous
Not applicable
I have a problem that I think is an Inventor issue, not VB...
I have a button that opens a form (Form1), so far so good.
On Form1 I put another button that opens up a new form (Form2). No problem.
The problem is that when I close Form2 it also closes Form1.

Is this as designed, or is it a bug?

Ronny
0 Likes
477 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Some code might help us. It could be Inventor but without seeing your
methods of opening and closing dialogs it's hard to tell.

Joe ...


wrote in message news:5988099@discussion.autodesk.com...
I have a problem that I think is an Inventor issue, not VB...
I have a button that opens a form (Form1), so far so good.
On Form1 I put another button that opens up a new form (Form2). No problem.
The problem is that when I close Form2 it also closes Form1.

Is this as designed, or is it a bug?

Ronny
0 Likes
Message 3 of 7

Anonymous
Not applicable
Well it is standard (I think) for VB...

To open Form1 I use
Private Sub InvButton_OnExecute(ByVal Context As Inventor.NameValueMap) Handles InvButton.OnExecute
Dim frm As New Form1
frm.ShowDialog()
End Sub

The same method is used to open Form2, but this is not a Inventor button.

Private Sub btn2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn2.Click
Dim frm As New Form2
frm.ShowDialog()
End Sub

When closing Form2 I use
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
Me.Close()
End Sub

Why this should close Form1 is something I do not understand...

Ronny
0 Likes
Message 4 of 7

Anonymous
Not applicable
I wrote a very simple add-in to test this and it works as expected. Only
the single dialog is dismissed when I click the button on it. I've attached
the add-in. It was written in Visual Studio 2005.
--
Brian Ekins
Autodesk Inventor API
0 Likes
Message 5 of 7

Anonymous
Not applicable
Well, your test project is working as expected on my computer too... I am still wondering why my forms are not behaving this way...

When I step through code, form1 is jumping from the line where it opens form2 and directly to form_closing procedure after closing form2...

Anybody???

Ronny
0 Likes
Message 6 of 7

Anonymous
Not applicable
You must be doing something slightly different in your code. Without seeing
your code it's difficult to say what the problem is.
--
Brian Ekins
Autodesk Inventor API
0 Likes
Message 7 of 7

Anonymous
Not applicable
A little VB2005 lesson 🙂
A button control has a property called DialogResult.
If this is set to anything (except None) the buttons parent form are closed after you click the button... if the form is shown using ShowDialog.

Ronny
0 Likes