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
3
votes
1 answer

Auto scroll DataGridView while typing

I have this problem where the last column in DataGidView is too long and you need to use scroll bar to go to show the rest of that column. But when I type a text, it will not auto scroll while typing. What I want is that I want to auto scroll the…
Rak
  • 139
  • 5
  • 20
3
votes
2 answers

How to add new row to datagridview only after specific cells of the row above are filled?

I'm working on a desktop application in C# (.NET 4.0). I have a datagridview filled with custom objects, via custom (it inherits BindingList) BindingList (added sorting functionalities). I use cellValidating events to properly increment first column…
Ben
  • 2,435
  • 6
  • 43
  • 57
3
votes
1 answer

How can I check the null cell value in the DataGridView?

How can I check the null cell value in a DataGridView in C#? I've used DBNull for checking, but it is not working. Can anybody help me? The code I currently have is: string[] ar=new string[dataGridView1.Columns.Count]; for(int…
priyanka
  • 543
  • 4
  • 10
  • 18
3
votes
2 answers

How can I implement filtering in the DataGridView control?

I want to develop an application which uses a DataGridView for showing the data from the table. And I want to add the filter row to the DataGridView. It means when the user clicks on the filter button then the DataGridView should add an empty row at…
priyanka
  • 543
  • 4
  • 10
  • 18
3
votes
1 answer

Selected items in DataGridViewComboBoxColumn always retrieve the first value

Assume the data I have are 'valuenumber1', 'valuenumber2', 'valuenumber3'. I have a problem where when 'valuenumber2' or 'valuenumber3' is selected, the next row will be created but the previous row (having 'valuenumber2' or 'valuenumber3') will…
3
votes
1 answer

C# 4 - DataGridView with proper ProgressBar control

I need to display a progress bar in a DataGridView. I've searched around and I've found many (many, many, ...) implementations that basically render a progress bar by drawing it into the cell. Isn't there a way to use a…
Ben
  • 20,737
  • 12
  • 71
  • 115
3
votes
3 answers

Is there a way to keep a DataGridView row selected when the user clicks on a cell in another row?

The DataGridView control allows you to click the row headers and select the rows (the whole row is highlighted), or use the mouse and click and drag to select multiple rows, etc. to select all of them. Anyway, I need the rows to stay selected if the…
Isaac Bolinger
  • 7,328
  • 11
  • 52
  • 90
3
votes
1 answer

Allow only specific letters to DataGridiView Cell

I have a datagridview on the form. and there are 4 columns in the grid - No, Answer, Key, Result. No, Key and Result Columns are read only. it means that i'm not going to enter some data to these columns. But i will enter values to Answer…
namco
  • 6,208
  • 20
  • 59
  • 83
3
votes
1 answer

DataGridView column with buttons for only some entries?

I have a DataGridView that needs a delete button for each row that has data: some rows may not have data. The DataGridViewButtonColumn seems to put a button in every cell, and I haven't been able to find a way to invisibilify (or perhaps even…
Smashery
  • 57,848
  • 30
  • 97
  • 128
3
votes
1 answer

dataGridView1 connect to my generic list?

dataGridView1 I want to connect to my generic list. To do this I use the code below. dataGridView1.DataSource = List; (List is static) But every time I want to update list generic dataGridView1 also get update What should I do?
mah_85
  • 621
  • 3
  • 9
  • 11
3
votes
0 answers

DataGridView Custom Sorting With Datasource

In my C# .NET application, I have a DataGridView. The grid's DataSource is a BindingSource, and the BindSource is bound to a filtered DataView of a DataTable that is requeried from SQL frequently. I can already sort columns in the grid, but the…
Rett
  • 41
  • 1
  • 4
3
votes
4 answers

DataGridView Not Updating in C# When Binding Source is Correct

I have a DataGridView and an Edit button. When I click the Edit button and change a field, I press Save and the DataGridView comes up again. The problem is that my changes aren't showing. Using the debugger, I have looked in the DGV and in the…
Missy
  • 1,286
  • 23
  • 52
3
votes
2 answers

Empty BindingSource problem

I have a problem with binding data using BindingSource, typed dataset and DataGridView. My problem is: BindingSource, therefore grid, is empty after binding data (bindingSource.Count is 0). I couldn't figure out what I'm doing wrong and I'd be very…
dstr
  • 8,362
  • 12
  • 66
  • 106
3
votes
2 answers

Why is DataGridView (re)draw so slow?

I know there are several questions in SO about slow DataGridViews, but I tried really everything mentioned there and most are about more complex databinding. what I did before: I tested DataTable as Datasource unbound Datagridview, populated in a…
Falco Alexander
  • 3,092
  • 2
  • 20
  • 39
3
votes
4 answers

How do I suppress automatic generated columns in a DataGridView?

When I assign a source (a DataTable) to a DataGridView, it automatically generates columns for each data column in the data table. But I only want the columns I defined manually. How do I suppress the creation of the these columns?
Luke
  • 5,771
  • 12
  • 55
  • 77