Sub New(nordId As Integer, dt As DateTime, ordNum As Integer) ' none of these parameters are ever used!
' This call is required by the designer.
InitializeComponent()
'' --- >>> [ i actually use the parameters here and load the datatable cTable used below, i took out to simpllify as it nor relevant to my question]
ingCellStyle = New DataGridViewCellStyle
With ingCellStyle
.ForeColor = Color.Red
.BackColor = Color.AliceBlue
.Font = New Font("Arial", 12.0!, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
.Alignment = DataGridViewContentAlignment.TopCenter
End With
loadDetails()
End Sub
Sub loadDetails()
With Grd
.AutoGenerateColumns = False
.DataSource = oCom.ds.Tables(ctable) ' this is a specific external datasource? Does it even exist at design time? : --- >>> [ create in the NEW()]
.Columns(0).DataPropertyName = "sort"
.Columns(1).DataPropertyName = "Desc"
End With
' Restyle
'=========
Dim i As Integer = 0
For Each orow As DataRow In oCom.ds.Tables(ctable).Rows ' why are we back to the table if it's already the datasource?
If orow("Type") = "I" Then ' I assume this means something
' are these lines operative or not? You have them commented out.
'MsgBox(orow("itemdesc")) --------------- [ not operative, just for testing to confirm it satisfies the condition]
' Grd.Rows(i).DefaultCellStyle = ingCellStyle
Try
Me.Grd.Rows(i).DefaultCellStyle.ApplyStyle(ingCellStyle)
Catch ex As Exception
MsgBox(ex.ToString) ' what's the point of this? There's nothing anyone can do about it! --- >>> [ Good point, again just for testing as vs2010 (on 64bit) does not report errors when debuging]
End Try
End If
i += 1
Next
' So we've been through this once for the initialisation. What happens if a new row is added or the pertinent value changed? -- >>> [ once loaded, its static now data will be added]
End Sub