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

c# add a dgv row with a dataGridViewComboBoxCell

I'm currently trying to add a ComboBox to a dataGridView. In the DGV, there are 5 columns: checkbox, string, string, combobox, combobox. both combobox-columns are configured as datagridviewcomboboxcolumns (via VisualStudio designer). My problem is…
NoMad
  • 702
  • 2
  • 11
  • 27
3
votes
1 answer

PointToScreen doesn't calculates the X value of a column in a DataGridView

For displaying a context menue at a click into the header of a DataGridView I use: private void dgv_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) { if(e.Button == MouseButtons.Right) { System.Drawing.Point…
UHM
  • 303
  • 1
  • 7
3
votes
1 answer

Need to populate a Dropdown combo box in Gridview, (unbound column)

I'm having difficulty populating a dropdown list in my gridview. I have created the column with the code below: If Not Me.GridViewIsConstructed Then gv.Columns.Add(createComboBoxWithDDL(Me.ddlGPField.Items, "Bank_GP_Field_Name",…
gkowieski
  • 31
  • 1
  • 3
3
votes
2 answers

Two DataGridViews; lining up columns

The project on which I'm currently working has two datagridviews that are meant to compare two versions of similar data (same number and name of columns). I'd like to resize all the columns so that they fit two criteria: 1) Autosize to fit data…
Frank Grimes
3
votes
1 answer

DataGridView won't repaint itself when updated from another thread

I have a problem updating DataGridView from another thread. Let me explain. When user clicks a button on a form I need to populate the grid with some rows. This process takes some time, so I'm doing it in a separate thread. Before starting the…
Dmitrii Erokhin
  • 1,347
  • 13
  • 31
3
votes
1 answer

DataGridView: DefaultCellStyle working with decimals

I am using a Datagidview control on winforms. This is getting filled dynamically. I am trying to display 4 decimal format number in the grid. I applied the DefaultCellStyle property as; dataGridViewCellStyle2.Format =…
VJOY
  • 3,752
  • 12
  • 57
  • 90
3
votes
1 answer

Adding bound combobox to datagridview

The scenario is almost the same as http://arsalantamiz.blogspot.com/2008/09/binding-datagridview-combobox-column.html. but I can't get it working on c#... I have mySql db with two tables: 1. protocols 2. pcapdata In protocols tables I have a two…
Guy L
  • 2,824
  • 2
  • 27
  • 37
3
votes
2 answers

How to make a ComboBox of a DataGridViewComboBoxColumn accept user new items?

Using a DataGridViewComboBoxColumn, the goal is to make the ComboBoxes accept user's new items and also the possibility of choosing items that are already present. I'm aware of using EditingControlShowing event of the DataGridView to change the…
didi
  • 725
  • 6
  • 10
3
votes
2 answers

Finding the total number of rows in DGV after filling

I have a form and one data grid view .... I am filling the datagrid view by uisng the below method private void EquipmentFinder_Load(object sender, EventArgs e) { productgridview.RowTemplate.Height = 130; var productsbycount =…
Glory Raj
  • 17,397
  • 27
  • 100
  • 203
3
votes
2 answers

c# DatagridView Control (VirtualMode) and Threading

I have a weird issue with the DataGridView control in virtual mode and threading. I use a Cache class to stored 2 pages of data. When I scroll down and I have to load a new page in cache, there is a little delay before data is display (it's ok).…
oL.
  • 196
  • 5
  • 15
3
votes
3 answers

Progress Bar for DataGridViewColumn

Here Mark Rideout, a Microsoft developer explains how to create a progress bar column in a DataGridView, and provides a "bare-bone" code for DataGridViewProgressColumn class. His instructions on how to use it for databound datagridviews are: If you…
OctoRazor
  • 31
  • 1
  • 1
  • 3
3
votes
1 answer

How to convert UTC datetime column to local time in datagridview?

I am doing work on a new logging database that I have decided to use UTC datetime to store all datetime values since our company spans timezones and multiple sources and timezones are logging events. That is working great. However the problem that I…
RiddlerDev
  • 7,370
  • 5
  • 46
  • 62
3
votes
1 answer

DataGridView Merging

Is it possible to merge 2 seperate DataGridView in C# into one? I am using a two seperate SortableBindingList for each DataGridView. Here is the code for the first DataGridView called theChipDGV. theChipList.Add(new Chip(splitLine[0], splitLine[1],…
theNoobGuy
  • 1,636
  • 6
  • 29
  • 45
3
votes
2 answers

Changing the style of Individual cells in a datagridview row

Is it possible to give individual cells in a data grid view row different styles such as backcolor, fontcolor etc? I do not mean giving the whole row a new style, only a specific cell.
Jon Winstanley
  • 23,010
  • 22
  • 73
  • 116
3
votes
2 answers

Changing color of a DataGridView Column according to value

I'm trying to change back color of a Column in my DataGridView, according to its value. Here is my code to do it. However, I get error in my if statement. I want to change the background color of the Column to Color.Red if its value is less than…
Swen22
  • 41
  • 3