i'm trying to display a list(of type) in a datagridview.
the datagridview has 2 columns, the 1st is a text column + the 2nd is a checkbox column. the datagridview resizes to the correct size but it doesn't display anything. what am i doing wrong?
vb.net Code:
Public Class Form1 Public Structure record Dim lastDatetime As String Dim checks As Boolean End Structure Private records As New List(Of record) Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load For x As Integer = -100 To -10 Step 10 Dim rec As New record Dim dt As Date = Now.AddDays(x) rec.lastDatetime = dt.ToString rec.checks = True records.Add(rec) Next Dim rec1 As New record rec1.lastDatetime = Now.ToString rec1.checks = False records.Add(rec1) dgv1.DataSource = records dgv1.Update() End Sub End Class




Reply With Quote