private void Detail1_Format(object sender,System.EventArgs e) { DataTable dt = new DataTable(); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("Age", typeof(int)); dt.Rows.Add("Name1", 23); dt.Rows.Add("Name2", 34); System.Windows.Forms.DataGridView gridView = ((System.Windows.Forms.DataGridView)this.customControl1.Control); gridView.DataSource = dt; }
Private Sub Detail1_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles Detail1.Format Dim dt As New DataTable() dt.Columns.Add("Name", GetType(String)) dt.Columns.Add("Age", GetType(Integer)) dt.Rows.Add("Name1", 23) dt.Rows.Add("Name2", 34) Dim gridView As System.Windows.Forms.DataGridView = DirectCast(Me.customControl1.Control, System.Windows.Forms.DataGridView) gridView.DataSource = dt End Sub