Questions tagged [datagridviewcolumn]

In WinForms DataGridViewColumn class represents a column in a DataGridView control.

In WinForms DataGridViewColumn class represents a column in a DataGridView control.

516 questions
3
votes
1 answer

DataGridView: Find if ColumnHeaders are really visible

How can I find out if column headers are visible in a Datagridview? Since the Datagridview control does not draw in a disabled state when disabled I am trying to emulate this by drawing a little lock icon in the top-left corner. Since this looks bad…
Jens
  • 6,275
  • 2
  • 25
  • 51
3
votes
2 answers

DataType for Saving Images in DataColumn of DataTable

I have a seemingly simple problem, I have created a DataTable dynamically and I add rows to it just fine. However I have a column that will have a flag which is an image. I had already imported the two flags(.png images) into the projects resources.…
Dev
  • 1,146
  • 2
  • 19
  • 30
3
votes
1 answer

how to set at runtime the column type of datagridview

I want to set the DisplayStyle of column 1 in my datagridview to "DropDownButton" with collection of ITEMS "A","B","C" and "D" at runtime. I tried below code also.. but it did not work : DataGridViewComboBoxCell comboCell = new…
Jana
  • 153
  • 5
3
votes
1 answer

How to disable a checkbox column on clicking of another checkbox column in DatagridView

I have two ckecboxes (Error and Enable) as under If I uncheck "Enable" checkbox, the corrresponding "Error" checkbox will become greyed out. I tried like the below but there is no enable or disable property void…
priyanka.sarkar
  • 25,766
  • 43
  • 127
  • 173
3
votes
5 answers

Is there a quick way to set all columns of DataGridView invisible?

I don't want to loop through all the columns and set each column's Visible to false. I wonder if there is a quick way to do so. Thank you!
King King
  • 61,710
  • 16
  • 105
  • 130
3
votes
2 answers

compare values in datatable, change it if they are the same

I want to check if under column "name" is there any same value. If yes so i want to check if the next same value > Bit + Size. I can do it with 2 for loops but what i want is something more simple. Can anyone show me how? My DataTable: name Bit …
Le Viet Hung
  • 489
  • 4
  • 10
  • 21
3
votes
1 answer

DataGridview with multiple information in same columns

I have Database query result, which bind to DataGridView control. Result would be like in c#. Column id(hidden in display) Description amount.** 1 abc 9/8/7/6/5/4/3/2 (depend on query)…
PantherUSA
  • 99
  • 2
  • 8
3
votes
3 answers

Compare datagridview cell value with image in the DataGridViewImageColumn

I have created a DataGridViewImageColumn and want to perform operation if the value of the image cell is green check box image. The code is given below. But its not going inside the condition if…
Pankaj Nagarsekar
  • 219
  • 1
  • 6
  • 17
3
votes
3 answers

How to remove sorting glyph in datagridview without removing Sorting facility

How can i remove sorting glyph from column headers in DataGridView without removing its sorting functionality. I am working on windows form application in C#, i want to generate report from a datagridview, where datagridview column width will assign…
3
votes
1 answer

Binding a DataGridView to an IBindingList that may contain zero elements

Using C# WinForms in VS 2008 (.Net 3.5) I am trying to bind a list, that may be empty, to a data grid. If the list has elements, and AutoGenerateColumns is enabled, the data binds to the list and everything works fine. However, if the list is empty,…
Josh Stribling
  • 1,068
  • 10
  • 13
3
votes
1 answer

Custom property won't save when changed in property window

I've created a custom column for DataGridView, and the reason is that I want to add a property (type) to a column. I right click the DataGridView and select "Edit columns...". Then when I select the column that is my custom column type I'm able to…
Gunnarsi
  • 354
  • 6
  • 13
2
votes
1 answer

C# Winforms DatagridView - setting different Color of button for different row

EDIT: trying to excute the following code in Winforms. I am fetching the data from xml & they are shown in the datagridview using custom class i have created.I have linked every column with DataPropertyName I want to show datagridview textboxes,…
2
votes
1 answer

Editable datagridview in c#

I have created a custom DataGridview for my project. I am trying to find a way by which when my datagridview got focused, it should go into editable mode. what i mean is its first cell of first cell should go into editable mode. what modifications…
ankit goel
  • 43
  • 6
2
votes
0 answers

How to set background color of each cell of each column of a selected row in DataGridView WinForms?

What I have tried, The below line of code changes a complete column background color. dataGridView.Columns[1].DefaultCellStyle.BackColor = Color.Yellow; But, I want to work the same for only a selected row. For example, I have 4 columns in…
2
votes
2 answers

How to get Design > Name property of DGV column from Header Text property

I am trying to go through un-checked items within a CheckedListBox1 and based on the values returned hide relevant columns within DataGridView1 but the issue is that the values displayed in CheckedListBox1 are the HeaderText property of DGV column…
Pawel
  • 141
  • 1
  • 10