Questions tagged [datagridviewcellstyle]

Represents a Style for DataGridViewCell

Learn more about DataGridViewCellStyle on MSDN.

44 questions
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
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
0 answers

How to fetch Cursor index in datagridviewcell in VB.NET

I want cursor index from datagridviewcell. example: Cell contains the text "ABCDE". In this AB|CDE consider pipe as a blinking cursor which can be changed with a mouseclick. so, I need cursor position. Detail: I've made a small project in which on…
bonny
  • 688
  • 1
  • 14
  • 33
2
votes
2 answers

DataGridView: Format values without actually changing the bounded data?

I've been searching through the web but I have not been able to find an answer. I have a DataGridView with a BindingSource bounded, which has a List of objects of a custom class. Among the fields of the class, I have a string field which I want to…
Sergio Rosas
  • 545
  • 12
  • 27
2
votes
2 answers

SelectionForeColor not working for link cells in DataGridViewLinkColumn of DataGridView

In my Winform 4.5 app, I have a DataGridView with first column as a link column. I would like to have the link color of the selected link cell to be white. Since by default the background color of a selected row (or a cell) is blue and the ForeColor…
nam
  • 21,967
  • 37
  • 158
  • 332
2
votes
2 answers

Overload DataGridViewCellStyle and give a default value

I'm writing a custom DataGridView object for a large project to hand out to a bunch of developers to make our app sections look consistent. I want to set defaults for many of the properties of the DataGridView, and I can set many of them like…
2
votes
2 answers

DataGridViewCellStyle Display numeric data in thousands

I was just wondering if there was a way to create a custom format in a DataGridViewCellStyle to display data in thousands. In Excel there is a custom format where you can type 1000 into a cell but it is displayed as 1. I've tried searching these…
Ryan Ward
  • 1,523
  • 4
  • 15
  • 23
1
vote
1 answer

How to Create/Draw Pi Graph in DataGridView Cell using C#.Net

My Target is to implement Pi Graph in DataGridView Cell, which will show renaming time of pending Orders Point of Sale System. When we place an Order on POS System it can be Delivery or Collection Order. Delivery and Collection Orders contain time…
1
vote
0 answers

DataGridView - Assigning DefaultCellStyle for each row run extremely slow

I have a DataGridView bound to a DataTable with 5000 rows, 36 columns and I'd like to change the cell style of each row based on its content, but the function I made take an insanely long time to run (100 rows every 5 min). This is my…
MonkeyH
  • 13
  • 5
1
vote
3 answers

Unable to change the background color of DataGridView cells

I'm attempting to loop through the rows within a datagridview and change the colour of a single cell depending on its stored value. I have tried the two methods below but neither work and no exceptions are thrown. 1: row.Cells[8].Style.BackColor =…
1
vote
2 answers

DataGridViewCell's style not updating on time

I am writing a C# application (windows forms) in which I have a 10x10 DataGridView which represents a maze. When a cell is clicked, I add the corresponding x and y to a 2D array. Each cell that is clicked, should display a black background. On…
knart
  • 311
  • 2
  • 13
1
vote
1 answer

Unable to change row header background color din XP display style but works in classic display style

I have a Windows form DataGridView. I am dynamically changing the background color of the row header. The background color is getting successfully changed if the OS display style is classic. However, background color of the row header does not…
user284534
  • 71
  • 1
  • 1
  • 2
1
vote
1 answer

Set CellStyle from code

I want to change the cell content text font and color based on it's value but I need to add the columns from code. The problem is that the table shows me HEX values instead of colorizing the cell values. I added in XAML resources:
ice 13
  • 333
  • 4
  • 17
1
vote
1 answer

How can we allow user to Add/Edit/Delete records from WPF gridview control in different ways?

In WPF xaml page I want to provide user one combobox in which there will be two options: (1) Allow user to edit in gridview (2) Allow user to edit in form If the user selects first option, then I want the user to allow adding/editing records in…
techfun
  • 913
  • 2
  • 13
  • 25
0
votes
1 answer

How to programmatically change empty DataGridView Cell back color?

I am making a gantt chart programatically. What I do is get the project's tasks bind it to the gridview, and then get the project duration in days, loop over it to add 1 additional column per day on the grid view. What I need to do is get the…
RMSP
  • 41
  • 2
  • 13
1
2 3