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
2 answers

Background colour of DataGridViewCheckboxCell

I have a DataGridView bound to a list of objects, and I'm setting a dynamic cell background colour using the CellFormatting event, as in this answer. This works well for every column except the DataGridViewCheckboxColumn. When I click inside this…
Adrian Cox
  • 6,204
  • 5
  • 41
  • 68
3
votes
1 answer

Winforms bindingsource issue adding new record

I have the following code to load an bind data to master-detail window, where master data bound to textboxes and other controls and detail data bound to DataGridView: ON FORM LOAD: DataSet dsOrders = new DataSet("dsOrders"); …
superconsultant
  • 231
  • 2
  • 6
  • 20
3
votes
1 answer

How to restore DataGridViewCellStyle to its inherited value

I have a DataGridView and I want to show the operator which values are changed by giving those values a different ForeColor. The operator can decide to discard all changes by clicking on a Discard button. In that case I need to let the cell use the…
Harald Coppoolse
  • 28,834
  • 7
  • 67
  • 116
3
votes
4 answers

add items to a combo box in a datagridview

How to add items to the drop down list of a combo box in a datagridview?
3
votes
2 answers

Custom DataGridView Column duplicates when using it in Designer

I made a custom DataGridView component which has a standard DataGridViewImageColumn inside. A new property changes the visibility of the column when i don't need in in a particular table. I add the column in the constructor and update it on…
Booser
  • 576
  • 2
  • 9
  • 25
3
votes
1 answer

How to bind a Navigation Property (second level properties) in DataGridView using BindingSource?

I have used two entity classes for binding values into DataGridView. One is Estimates and Companies. Estimates has columns such as "Id, Estimate Number, Estimate Amount, CompanyId". Companies has columns such as "Id, Company Name, Address" I…
3
votes
2 answers

c# Datagridview (Winform) cell coloring based on adjacent cell value

Is it possible to color datagridview cell based on multiple conditions. I know I can change the color of the cells based on that cell value. but is it possible to add condition where i can also apply color based on adjacent cell value. To compare…
princeton
  • 33
  • 6
3
votes
1 answer

set last row of a datagridview not sortable (always on bottom)

I have a sortable DatagridView with a summary last row containing sum of some columns, i want to keep this summary row always as the last line(bottom) of datagridView. At the moment, when i sort a column of datagridView also the summary row get…
aleroot
  • 71,077
  • 30
  • 176
  • 213
3
votes
2 answers

CRUD Operations using DataGridView, DataTable and DataAdapter - Cannot add new row to DataGridView

I'm trying to insert new records into the source table from the C# interface grid view.... But when I retrieve the records with the buttonclick code shown below... Im getting records in the gridview but no option for inserting new records(screen…
Gowtham Ramamoorthy
  • 896
  • 4
  • 15
  • 36
3
votes
1 answer

Use DataGridView CheckBox Column for a string data column

I have this table in database: applicant | module | date | approvation | xxxx xxxx xxxx xxxxxxx yyyy yyyy yyyy yyyyyyy tttt tttt tttt ttttttt I have this db table. After…
rul3z
  • 173
  • 1
  • 16
3
votes
1 answer

Can I FORCE the filter button to show on my DataGridViewColumnHeader?

I have a C# WinForms DataGridView that by default does not (and cannot) have filtering enabled. The result is that when I display the DGV there are no filtering buttons displayed. As opposed to using a DataTable (not an option in my case) I would…
CJe
  • 1,928
  • 3
  • 24
  • 53
3
votes
2 answers

Hide id column from datagridview but need to use it

I want to hide id column from datagridview. I tried by changing stored procedure / SQL query, it works but I was unable to get id of that entry for some reason I also need id of each entry but don't want to show on front end. Any suggestions,…
Najam Islam
  • 83
  • 2
  • 11
3
votes
1 answer

How do I display a digital timer (StopWatch) in datagridview column dynamically c#?

I have datagridview whose datasource is datatable. I have two columns in datagridview: NAME, IN TIME After the datagridview is loaded, I want to add a new column called DURATION which is a timer column i.e. based on the IN TIME, DURATION column…
CST RAIZE
  • 428
  • 1
  • 5
  • 18
3
votes
3 answers

DataGridView HasErrors?

I wish to prevent the user from saving changes made to a DataGridView if it has any validation errors (set using the ErrorText property of a cell using the CellValidating event). I'm looking for (but cannot see) a method such as…
Rezzie
  • 4,763
  • 6
  • 26
  • 33
3
votes
1 answer

Get max DataGridViewRow based on Record ID using LINQ

I am trying to get the DataGridViewRow with the max record id value. I am able to get the record id itself but I need to find the row itself. This is my code for getting the max record id and it works fine: var addedRow = …
ehh
  • 3,412
  • 7
  • 43
  • 91
1 2 3
99
100