hey guys i have a class that i defined variables like that
public string cekilis_no{ get; set; }
public string cekilis_tarihi { get; set; }
public string sayi_bir { get; set; }
public string n_iki { get; set; }
public string n_uc { get; set; }
public string n_dort { get; set; }
public string n_bes { get; set; }
public string n_alti { get; set; }
and i give their values with the datas from my database with SqlDataReader and i show them by datagridview in my form..but my problem is that the headers shown as i wrote in my class like n_bes,n_alti, like here..how i can show it like Number 5 or Number 6 ??
Loading

Madhu KRank #1,514 · 1.1K reputationPosted Dec 9, 2010, 3:34 AM EST
int count = 1;
foreach (DataGridViewColumn cmn in dataGridView1.Columns)
{
cmn.HeaderText = count.ToString();
count++;
}
Erdinc Kolukisa109 reputationPosted Dec 9, 2010, 3:42 AM EST
Madhu KRank #1,514 · 1.1K reputationPosted Dec 9, 2010, 3:47 AM EST
Erdinc Kolukisa109 reputationPosted Dec 9, 2010, 4:16 AM EST
cmn.HeaderText = "Kolon"+count.ToString();
and i tried something like that also
dataGridView1.Columns[1].HeaderText = "Çekilis Tarihi";
it gives the result as i wish but i thought i can rename columns while i am selecting in Sql like below
Select id, cekilis_no[ÇekiliS No], cekilis_tarihi[Çekilis Tarihi], num1[Birinci Say], num2[kinci Say],num3[nc Say], num4[Drdnc Say], num5[Beinci Say], num6[Altnc Say] From NumaraBilgileri
Madhu KRank #1,514 · 1.1K reputationPosted Dec 9, 2010, 9:07 PM EST
CrishRank #1,486 · 1.1K reputationPosted Dec 10, 2010, 12:39 AM EST
You can refer this code to solve the issue of changing datagridview header text.
Private Sub Button9_Click(ByVal sender As Object, _ ByVal args As EventArgs) Handles Button9.Click For Each column As DataGridViewColumn _ In dataGridView.Columns column.HeaderText = String.Concat("Column ", _ column.Index.ToString) Next End Sub