Hi Guys,
In ipart there is an option to add and delete rows when working with inventor graphically.
I have displayed the iPart table and the values in gridview using VB.Net.
The user then selects the row in datagridview and clicks the button delete.
When the button onclick even is triggered i want to delete the selected row on ipart table inside inventor
Does anybody has an idea of how to do it ???
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
Here's some sample code that illustrates deleting a row from the table of an iPart factory. The example deletes the last row. In your case I suspect you've loaded them into your grid in the same order as they are in the factory so you know the index of the row to delete.
Public Sub DeleteIPartRow() Dim partDoc As PartDocument Set partDoc = ThisApplication.ActiveDocument If Not partDoc.ComponentDefinition.IsiPartFactory Then MsgBox "Must be an iPart factory." Exit Sub End If Dim factory As iPartFactory Set factory = partDoc.ComponentDefinition.iPartFactory factory.TableRows.Item(factory.TableRows.Count).Delete End Sub
I have already tried this, but i need the user to select the row from datagridview and then use the delete button.
And Yes I've added all the data in the same order as displayed in inventor, and also disabled the sorting of columns in datagridview.
Is there any way to pass the datagridview selected row index in the below code
factory.TableRows.Item(factory.TableRows.Count).Delete)