Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrids - General Question

Status
Not open for further replies.

sanders720

Programmer
Aug 2, 2001
421
0
0
US
I am messing around with Datagrids in VB.NET 2003. Can these be used like the flex grid in VB6, where I can populate data according to the data itself, instead of another database structure? I have sompe properties in Autodesk Inventor that I want to manipulate!

Thanks for the help!


Private Sub cmdGetProp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGetProp.Click
' Define Part Document
Dim objApprenticeServerDocument = objApprenticeServerApp.Open(txtPartName.Text)
If Err.Number Then
MsgBox("Unable to open the specified file", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation)
Exit Sub
Else
MsgBox("FILE OPEN!")
End If
On Error GoTo 0

' Properties: Summary Info
Dim oProp1 As Inventor.PropertySet
oProp1 = objApprenticeServerApp.Document.PropertySets("{F29F85E0-4FF9-1068-AB91-08002B27B3D9}")

' Properties: Design Summary Info
Dim oProp2 As Inventor.PropertySet
oProp2 = objApprenticeServerApp.Document.PropertySets("{D5CDD502-2E9C-101B-9397-08002B2CF9AE}")

' Properties: Design Tracking
Dim oProp3 As Inventor.PropertySet
oProp3 = objApprenticeServerApp.Document.PropertySets("{32853F0F-3444-11D1-9E93-0060B03C1CA6}")

' Properties: User Defined
Dim oProp4 As Inventor.PropertySet
oProp4 = objApprenticeServerApp.Document.PropertySets("{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")

Dim dgtsStyle As DataGridTableStyle
Dim dgtsColumn As DataGridTextBoxColumn

dgtsStyle = New DataGridTableStyle

With dgtsStyle
.MappingName = "Properties"
End With

' Add PartNo Column
dgtsColumn = New DataGridTextBoxColumn
With dgtsColumn
.MappingName = "txtPartNo"
.HeaderText = "Part No."
.Width = 50
End With
dgtsStyle.GridColumnStyles.Add(dgtsColumn)

' Add Column PartNo
dgtsColumn = New DataGridTextBoxColumn
With dgtsColumn
.MappingName = "txtPartNo"
.HeaderText = "Part No."
.Width = 50
End With
dgtsStyle.GridColumnStyles.Add(dgtsColumn)

' Add Column RefPartNo
dgtsColumn = New DataGridTextBoxColumn
With dgtsColumn
.MappingName = "txtRefPartNo"
.HeaderText = "Ref Part No."
.Width = 50
End With
dgtsStyle.GridColumnStyles.Add(dgtsColumn)

' Add Column Length
dgtsColumn = New DataGridTextBoxColumn
With dgtsColumn
.MappingName = "txtLength"
.HeaderText = "Length"
.Width = 20
End With
dgtsStyle.GridColumnStyles.Add(dgtsColumn)

' Add Column RSP
dgtsColumn = New DataGridTextBoxColumn
With dgtsColumn
.MappingName = "chkRSP"
.HeaderText = "RSP"
.Width = 10
End With
dgtsStyle.GridColumnStyles.Add(dgtsColumn)

' Add Column Description
dgtsColumn = New DataGridTextBoxColumn
With dgtsColumn
.MappingName = "txtPartDesc"
.HeaderText = "Part Description"
.Width = 100
End With
dgtsStyle.GridColumnStyles.Add(dgtsColumn)
 
I am not answering you question but it is better if you used the block:

Try
Dim objApprenticeServerDocument = objApprenticeServerApp.Open(txtPartName.Text)
MsgBox("FILE OPEN!")
Catch ex As ...(exception)
MsgBox("Unable to open the specified file", MsgBoxStyle.OKOnly + MsgBoxStyle.Exclamation)
Exit Sub
Finally
..
End Try

Also replace the on error goto 0 with that block
 
Okay.

Any help with the other question would be great!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top