Questions tagged [datagridview]

DataGridView is a Windows Forms control used to display and edit tabular data.

DataGridView is a Windows Forms control found in the .NET Framework starting at version 2.0. It is used to display and edit tabular data from many different kinds of data sources. It provides a rich set of features such as sorting, filtering, grouping, and editing data.

Useful links

20349 questions
25
votes
7 answers

DataGridView keydown event not working in C#

DataGridView keydown event is not working when I am editing text inside a cell. I am assigning shortcut Alt+S to save the data, it works when cell is not in edit mode, but if it is in edit mode below code is not working private void…
Javed Akram
  • 15,024
  • 26
  • 81
  • 118
25
votes
2 answers

Hide the extra row at the bottom in a DataGridview in a Winform Application

I have binded a datagridview to a datatable. But the gridview displays an extra empty row at the bottom ? How should I hide it ? Thanks in Advance
Ananth
  • 10,330
  • 24
  • 82
  • 109
25
votes
4 answers

How to Merge DataGridView Cell in Winforms

I have some data in a grid that currently displays like this: ------------------ |Hd1| Value | ------------------ |A | A1 | ------------------ |A | A2 | ------------------ |A | A3 | ------------------ |A | A4 …
M. Rain
  • 315
  • 1
  • 5
  • 10
25
votes
4 answers

Selecting rows programmatically in DataGridView

I want to select row of previously selected rows after some event my code is as below. int currentRow = dgvIcbSubsInfo.CurrentCell.RowIndex; //code to execute dgvIcbSubsInfo.Rows[currentRow].Selected = true; after executing the code the preview…
manoj
  • 5,235
  • 7
  • 24
  • 45
24
votes
6 answers

Rows cannot be programmatically added to the datagridview's row collection when the control is data-bound

First of all, I looked up this related question in here but the solution dataGridView1.Rows.Add() doesn't work in my case. In my Datagridview, I have 3 TextBoxes for data input and 2 ComboBoxes for the user to choose the values (which are bound…
24
votes
2 answers

Populating a DataGridView with Text and ProgressBars

I am creating a multi-threaded application in which each thread will appear as a row in my DataGridView. I want a ProgressBar in each row indicating the corresponding thread progress. The question is, is this possible? And if so, how?
dlock
  • 9,447
  • 9
  • 47
  • 67
24
votes
3 answers

Good DataGridView tutorial

I'm writing a windows C# application which I wish to use data grid views, but unable to find a good tutorial on to take complete control of the datagrid eg: add columns, add data etc.
instigator
  • 1,587
  • 5
  • 15
  • 27
24
votes
2 answers

Hide left column DataGridView

I'm creating a Visual Basic program in VS2010. I'm using a DataGridView to display a .csv, but I don't want to show the left column, it's ugly. Is there any form to hide it?
alvr
  • 391
  • 1
  • 3
  • 9
24
votes
17 answers

Check/Uncheck a checkbox on datagridview

Can someone help me why it doesn't work? I have a checkbox and if I click on it, this should uncheck all the checkbox inside the datagridview which were checked before including the user selected checkbox. Here is the code: private void…
user1647667
  • 1,269
  • 4
  • 14
  • 26
24
votes
13 answers

Why does my ColumnHeadersDefaultCellStyle keep being reset in Visual Studio designer?

I am trying to make the column headers of my DataGridView bold, in Visual Studio 2008. Every time I change my ColumnHeadersDefaultCellStyle to Calibri 9.75pt bold, using the properties box, the next time I reopen the saved form, the…
Tony Peterson
  • 20,522
  • 15
  • 48
  • 66
23
votes
12 answers

DataGridView ComboBox Column: Change cell value after selection from dropdown is made?

I have setup a ComboBoxColumn for my DataGridView and set its selectable values from an enumeration. It mostly works as I would like with the following exception. Whenever I click the dropdown arrow and then select one of the enum values, it remains…
john
  • 4,043
  • 7
  • 27
  • 39
23
votes
5 answers

Reading data from DataGridView in C#

How can I read data from DataGridView in C#? I want to read the data appear in Table. How do I navigate through lines?
sharon
  • 285
  • 1
  • 3
  • 6
23
votes
9 answers

Ensuring text wraps in a dataGridView column

I have dataGridView with a particular column. When I write long text in dataGridView it shows me a shortened version, with ellipses, because the column isn't wide enough to display the entire string. | textdsadasda... | What do I must to do if I…
nirmus
  • 4,913
  • 9
  • 31
  • 50
23
votes
21 answers

Horizontal Scrollbar is not visible on DataGridView

I have a DataGridView on Window form which is populated with 30 columns and thousands of rows. ScrollBars property is set to Both, but still horizontal scroll bar is not visible. even I am unable to scroll with arrow key from keyboard. I tried it by…
Scorpion
  • 4,495
  • 7
  • 39
  • 60
23
votes
5 answers

Disabling editing in DataGridView

I'm using Visual Studio 2012. I want to disable the editing on the DataGridView, it seems to work when I used this code: private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { dataGridView1.ReadOnly =…
Jonald Samilo
  • 297
  • 1
  • 2
  • 11