Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我在 DataGridView 中选择特定单元格时,如何在文本框中显示列标题?
尝试这个:
int idx = this.dataGridView1.SelectedCells[0].ColumnIndex; this.textBox1.Text = this.dataGridView1.Columns[idx].HeaderText;