DataGridView Seçili Hücrenin
Sütun Başlığını Almak
Merhaba arkadaşlar. Bu
makalemizde datagridview nesnesinde seçili hücrenin sütun başlığını alacağız. 

Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
           
InitializeComponent();
        }
        private void
Form1_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the
'northwindDataSet.Customers' table. You can move, or remove it, as needed.
            this.customersTableAdapter.Fill(this.northwindDataSet.Customers);
           
dataGridView1.MouseClick += new MouseEventHandler(dataGridView1_MouseClick);
        }
       
        private void
dataGridView1_MouseClick(object sender, MouseEventArgs e)
        {
           MessageBox.Show( "Sütun
Adı: " +
dataGridView1.Columns[dataGridView1.CurrentCell.ColumnIndex].HeaderText.ToString());
        }
    }
}
Bir makalenin daha sonuna geldik. Bir sonraki makalede
görüşmek üzere. Bahadır ŞAHİN