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!

Column Styles & Mapping

Status
Not open for further replies.

sanders720

Programmer
Aug 2, 2001
421
0
0
US
I have a question about column styles and mapping using VB.NET. I think I've setup the column styles okay, but columns themselves are not mapped.

First, I define the column styles...

Public Sub PopulateDataGrid1_DefineColumns()

' Define Table

' Part Qty
Dim aCol0 As New DataGridTextBoxColumn
With aCol0
.MappingName = "QTY"
.HeaderText = "Quantity"
.Width = 6

End With

' Sub Assembly
Dim aCol07 As New DataGridTextBoxColumn
With aCol07
.MappingName = "SUBA"
.HeaderText = "SubLevel"
.Width = 20

End With
.
.
.
Then I add the columns...

' Add Columns
With aPartTableStyle.GridColumnStyles
.Add(aCol0)
.Add(aCol07)
.
.
.
Then I define the specific per column data for the row...

Public Sub PopulateDataGrid1_DefineRows()
' Define Column Data

' Map Part Table Style
aPartTableStyle.MappingName = "Parts"

' Quantity
Q = Q

' Sub Assembly
SUBA = SUBA
.
.
.

' Bind the Datatable to the Datagrid
DataGrid1.DataSource = aPartsTable
DataGrid1.AllowSorting = True

Then I add the rows. Tis is where the error shows up...

' Add Rows
Dim aRow As DataRow
aRow = aPartsTable.NewRow()
aRow("QTY") = Q '<---ERROR Column QTY does not belong to the table
aRow("SUBA") = SUBA
 
Any help with what I have not done would be greatly appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top