datagridview

DataGridView CheckBox Question

Hey guys, I am writing an application that retrieves the Group Names and access permissions for each NT group populated from the foreach loop. In addition, I have included a DataGridView control where each cell has a checkbox column, the application is going to check each cell accordingly e.g Read, Write, Modify, etc for each group. I ca...

Drag/drop ins Data Grid View -Row and column are always -1

I am trying to take text from a list box control and put it into a particular cell in a data Grid. I am using the following code: private void DG_DragDrop(object sender, DragEventArgs e) { DataGridView.HitTestInfo theHit = DG.HitTest(e.X, e.Y); int theCol = theHit.ColumnX; int theRow = theHit.RowY; ...

Winform Merging two columns

HI, I want to create a datagridview in a form with 4 columns basically which has only 2 column headers, ie i want to merge only the column headers of 2 columns. Thanks in advance ...

.NET Unbound DataGridView AllowUsersToAddRows problem

I have an unbound DataGridView, which fill manually with DataGridViewRows. AllowUserToAddRows is set to false and everything works as expected - no NewRow is shown in the botomn of the grid. In one method I add some more rows, edit some rows and remove some others. These manipulations work fine, BUT after these manipulations the NewRow ...

How can I get the value of all the selected cells in a DataGridView?

I have a DataGridView that has MultiSelect = true. After the user selects different cells from different rows how can I get the value of all the selected cells? is it using a foreach() or a simple build in method? ...

C# DataGridView bit value (WinForms)

Hello, I want to ask if I can put the checkbox that is originated from a bit value, into state of "intermediate". Is is possible to convert any cell (bit value cells) into checkboxes? Thank you. ...

Checkbox in Datagridview cannot be changed.

I've created a Datagridview bound to a Datatable. This Datatable is updated by a event to reflect statistical information as it changes (sub second resolution). I have a checkbox to determine if a row is available for other functions and can be toggled on and off normally if my eventhandler is not receiving my updates. If my bound Datat...

Hosting a UserControl inside a custom DataGridViewCell

I created a custom DataGridViewCell to show a specific UserControl when the user starts editing the cell. Basically the control contains a TextBox with a suggestion list easily handled by the code. I got my code to resize the list correctly, and have it contain exactly what I want and where I want it. The problem I have now is that the c...

DataGridView: How to select an entire Column and deselect everything else?

I been trying to find out how to select all cells under a Column with a 'mouse right click+menu+Select this Column'... MSDN isn't helping much... I get this error when I try to change selection mode: DataGridView control's SelectionMode cannot be set to FullColumnSelect while it has a column with SortMode set to DataGridViewColumnSo...

DataGridView: Keep selections after datasource is changed?

Is there a way to keep the selected cells of a DataGridView selected after the DataSource is changed? ...

automatically create a form at runtime based on datasource c#

Hello, i wish to create a form at runtime that will read the columns for any datasource and create fields based on the columns and datatype just like a datagridviews insert line Best regards, Mark ...

C# coloring the same values in row of datagridview

Hi, Say I have a datagridview filled with rows. Now to make certain data more distinct I'd like to color the background of certain cells. There's some caveats though, the amount of columns I want coloring in can vary. To make things more clear I'll sketch up a fake datagrid: Name Thing2 col1 col2 col3 tes test 1 1 2 t2t e...

Check which bound DataGridViewColumn is clicked on

The DataGridViewCellMouseEventArgs object provided in the events (eg CellMouseDown, CellDoubleClicked) gives the column as a numeric index in DataGridView.Columns but I don't want to hardcode a number into my event handler. I'm using a strongly typed dataset and am wondering if there's a way to find out what the column index for MyDataR...

How to set DataGridView columns text format to uppercase by adding new property?

Hello, I have a custom DataGridView control and want to set the text format for custom columns in the designer (CellStyle builder). Let's say I want to make the text format to uppercase. After searching about this I've found some solutions with adding new events and then changing the text format but this is not what I want. I want to ...

add txet to report

i have a form it has combox and txet1,txet2, and buttun when the user press on buttun it will open a report depending on what user inter on text1 and text2 and what user chois from comboox i work with visual studio 6 ,crystalreport9 ...

DataGridView Checkbox Column cannot display correctly in one workstation when customized it

Hi, I got a problem that when I created a customize control using panel and added a DataGridView into it, one of workstation cannot show the checkbox column checkbox (just show a empty column which haven't see the checkbox) and that DataGridView ordering is totally changed. I have tested to uninstall and re-install all the .net framewo...

Binding SQL table to DataGridView in WPF

How can I bound SQL table to datagridview in WPF? ...

How to use multiple List<> as DatagridView's datasource

I'm looking for a highly efficient way to save data to a table like structure in C#. The number of rows, columns and data type for each column is determined at runtime. One of my approaches is to create a struct that defines a column. The struct consists of ColumnName, Units, and a generic List of doubles. (For now I am sticking to one d...

How to refresh the DataSource on a WinForms DataGridView?

I populate the GridView.DataSource from a EntityFramework Model: gwTimeLog.DataSource = _entities.TimeLogs; When a new row is added to the _entities, I try to update the grid (tried using the same statement as above, setting it null, then back to _entities.TimeLogs, etc...), but the grid simply won't update. Even though _entities.Tim...

Winform DatagridView Numeric Column Sorting

I am using just a simple DataGridView to hold a bunch of data (Funny that). I have decimals in a particular column. But when it comes to ordering by that decimal column, it orders it incorrectly. For example : Starting order might be : 0.56 3.45 500.89 20078.90 1.56 100.29 2.39 The ending order would be : 0.56 100.29 1.56 200...