I created a new DataGridViewColumn type called DataGridViewGradeColumn.
Then I mad a DataGridView (called grd), added some columns to it, and tried to access on of the new column properties.Code:Public Class DataGridViewGradeColumn Inherits DataGridViewTextBoxColumn Public Property AssignmentName As String Public Property AssignmentType As String Public Property AssingmentPerfectScore As Integer End Class
lCode:Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load grd.RowCount = 5 End Sub Private Sub btnNewColumn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNewColumn.Click grd.Columns().Add(New DataGridViewGradeColumn) Dim i As Integer = grd.ColumnCount - 1 grd.Columns(i).Width = 30 grd.Columns(i).DefaultCellStyle.Alignment = ContentAlignment.MiddleRight 'grd.Columns(i).AssignmentName = "some text" End Sub Private Sub btnGetRowTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetRowTotal.Click Dim r As Integer = grd.CurrentRow.Index Dim t As Integer = 0 For c As Integer = 2 To grd.ColumnCount - 1 t = t + CInt(grd.Item(c, r).Value) Next MsgBox(t.ToString) End Sub End Class
The new properties don't show up in intelisense.
How do I access my custom properties?




Reply With Quote