datagridview

Setting DataGridView.DefaultCellStyle.NullValue to null at designtime raises error at adding rows runtime.

In Visual Studio 2008 add a new DataGridView to a form Edit Columns Add a a new DataGridViewImageColumn Open the CellStyle Builder of this column (DefaultCellStyle property) Change the NullValue from System.Drawing.Bitmap to null Try to add a new Row to the DataGridView at runtime (dataGridView1.Rows.Add();) You get this error: System....

Winform DataGridView font size . .

How do i change font size on the datagridview? ...

DataGridView column of type DataGridViewCheckBoxCell is constantly readonly/disabled

Hello, I am using a .NET Windows Forms DataGridView and I need to edit a DataBound column (that binds on a boolean DataTable column). For this I specify the cell template like this: DataGridViewColumn column = new DataGridViewColumn(new DataGridViewCheckBoxCell()); You see that I need a CheckBox cell template. The problem I face is t...

Disable selection of rows in a datagridview

I want to disable the selection of certain rows in a datagridview. It must be possible to remove the select property for one or more datagridview rows in a datagridview shown in a winform. The goal is that the user can't select certain rows. (depending on a condition) Thankx, ...

Trigger update on DataTable bound to DataGridView

In my .NET/Forms app I have a DataGridView which is bound to a DataTable. The user selects a row of the DataGridView by double-clicking and does some interaction with the app. After that the content of the row is updated programmatically. When the user selects a new row the changes on the previous one are automagically propagated to the...

How can I highlight the current cell in a DataGridView when SelectionMode=FullRowSelect

I have an editable DataGridView with SelectionMode set to FullRowSelect (so the whole row is highlighted when the user clicks on any cell). However I would like the cell that currently has focus to be highlighted with a different back color (so the user can clearly see what cell they are about to edit). How can I do this (I do not want t...

DataGridView : How to can I do multiline data entry in a usable way?

With the DataGridView it is possible to display cells containing some long text. The grid just increases the row height to display all the text, taking care of word wrap and linefeeds. Data entry is possible as well. Control+Return inserts a line feed. But: if the cell only has one line of text initially, the row height is just the heig...

DataGridViewComboBoxColumn adding different items to each row . .

I am building a table using the DataGridView where a user can select items from a dropdown in each cell. To simplify the problem, lets say i have 1 column. I am using the DataGridViewComboBoxColumn in the designer. I am trying to support having each row in that column have a different list of items to choose from. Is this possible? ...

Programmatically setting the record pointer in a C# DataGridView

How do I programmatically set the record pointer in a C# DataGridView? I've tried "DataGridView.Rows[DesiredRowIndex].Selected=true;", and that does not work. All it does is highlight that row within the grid; it doesn not move the record pointer to that row. ...

Set selected item on a DataGridViewComboboxColumn

I have a datagridview with a DataGridViewComboboxColumn column with 3 values: "Small", "Medium", "Large" I get back the users default which in this case is "Medium" I want to show a dropdown cell in the datagridview but default the value to "Medium". i would do this in a regular combobox by doing selected index or just stting the Te...

Setting DataGridViewRow.Height slow

I have noticed that setting row height in DataGridView control is slow. Is there a way to make it faster? ...

Setting the focus in a datagridview in windows form

I have a datagridview that accepts a list(of myObject) as a datasource. I want to add a new row to the datagrid to add to the database. I get this done by getting the list... adding a blank myObject to the list and then reseting the datasource. I now want to set the focus to the second cell in the new row. To CLARIFY i am trying to set ...

ASP.NET Grid Controls with minimal HTML output?

Looking to identify an asp.net grid control that has more functionality and ease of use than the standar asp.net grid control but doesn't punish you wiht excessive html or javscript code. Currently using infragistics but the html for a page is typically in the 90k range and the js that is parsed/downloaded is about 250k. This seems exces...

DataGridViewCell Bordercolor

Does anyone know how to change the Bordercolor for a Datagridviewcell in c#? Here's a picture of what I mean: Picture Backgroundcolor, Textcolor and Images are no Problem, but I don't know how to realise the Borders. EDIT: I want to realise this with winforms. Another problem is the cross in the second Row, but that's for later......

DatagridView virtual model with comboboxColumn

is it possible to have different items in different rows within a comboboxcolumn in a datagridview. This would be using virtual mode. Code samples would be great. ...

Datagridview virtual model combobox

how can you dynamically add items to a combobox using the datagridview virtual mode? ...

C# grid binding not update

I have a grid that is binded to a collection. For some reason that I do not know, now when I do some action in the grid, the grid doesn't update. Situation : When I click a button in the grid, it increase a value that is in the same line. When I click, I can debug and see the value increment but the value doesn't change in the grid. BUT...

Horrible redraw performance of the DataGridView on one of my two screens.

I've actually solved this, but I'm posting it for posterity. I ran into a very odd issue with the DataGridView on my dual-monitor system. The issue manifests itself as an EXTREMELY slow repaint of the control (like 30 seconds for a full repaint), but only when it is on one of my screens. When on the other, the repaint speed is fine. I h...

DataGridView Edit Column Names

Is there any way to edit column names in a DataGridView? ...

LINQ: custom column names

UPDATE I'm basically binding the query to a WinForms DataGridView. I want the column headers to be appropriate and have spaces when needed. For example, I would want a column header to be First Name instead of FirstName. How do you create your own custom column names in LINQ? For example: Dim query = From u In db.Users _ ...