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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add column dynamically in datagridview

Status
Not open for further replies.

nnuswantari

Programmer
Nov 21, 2009
17
ID
I have a datagridview with 1 column and any rows. I will use this to entry any data. What can I do to make this column can be added dynamically in runtime???
 
dim DcDtb as new datatable
dim SlCm As New DataGridViewTextBoxColumn, MgpCm As New DataGridViewTextBoxColumn, ImCm As New DataGridViewComboBoxColumn


DataGridView1.DataSource = DCDtb
DataGridView1.Columns.Remove("sl_no")
DataGridView1.Columns.Remove("mgp_sln")
DataGridView1.Columns.Remove("itm_description")

DataGridView1.Columns.Add(SlCm)
slcm.DataPropertyName="sl_no"
DataGridView1.Columns.Add(MgpCm)
MgpCm.DataPropertyName="mgp_sln"
DataGridView1.Columns.Add(ImCm)
ImCm.DataPropertyName="Itm_Description"

blah....blah...blah....



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top