edit databound datagridview column header text

thejeraldo

Well-known member
Joined
Jun 9, 2009
Messages
70
Location
Philippines
Programming Experience
1-3
how do i change the colmun header text of a datagridview if ive set its datasource from a dataset?

VB.NET:
dgEmpList.DataSource = ds
dgEmpList.DataMember = ds.Tables("employees").ToString
 
thanks for the response guys. i know how to do it now.
i did it like this:
VB.NET:
da = New OleDb.OleDbDataAdapter(strsql, con)
da.Fill(ds, "employees")
dgEmpList.DataSource = ds
dgEmpList.DataMember = ds.Tables("employees").ToString
dgEmpList.Columns(0).HeaderText = "Employee ID"
dgEmpList.Columns(1).HeaderText = "Last Name"
dgEmpList.Columns(2).HeaderText = "First Name"
dgEmpList.Columns(3).HeaderText = "Department"
dgEmpList.Columns(4).HeaderText = "Position"
dgEmpList.Columns(5).HeaderText = "Location"
dgEmpList.Columns(6).HeaderText = "Status"

hope this code can help anybody in the future. :)
 

Latest posts

Back
Top