datagridview

How Do I Edit Database Records In A DataGridView Using LINQ to SQL?

I'm so close on this one, but I need a little help. I have a simple WinForms app that uses LINQ to SQL to grab data that needs to be reviewed from a database and stuff it into a DataGridView. That part works great, but the connection I can't seem to make is how to get the data back into the database when things change. Here's what I h...

How to Create Collapsible Data Grid?

How to Create Collapsible Data Grid in dot net windows form application? ...

DataGridView bound to DataTable. Getting comboboxes for enums.

If you have a DataTable that has a column of some Enum type. And you bind a DataGridView to this DataTable (myDgv.DataSource = myDataTable).. How can you make the DataGridView show a combobox (or is it drop-down-list? The one where the only thing you can do is select) in each cell of for this column? The combobox should have the curren...

How to print dataGridview

Hai How to print All data from datagridview in vb.net. Please Help me. thanks in advance ...

How to create a XML File from Datagridview control in Windows Form application?

I am creating a XML file in Windows application, In the form I have DataGridView control, user clicks on the row and enter text or select values from Combo boxes. I create rows programatically, say after 10 rows have been created, i want to save that information to a XML file so that next time my application runs, the datagridview is pop...

Bypass read only cells in DataGridView when pressing TAB key

Can anyone show me some code of how I could bypass read only cells in DatagridView when pressing TAB key? ...

C# - Help with Customised DatagridView Cell Options

Hi, I am trying to customise a DataGridView cell to include a combobox and a text field. So far myCell class derives from DataGridViewTextBoxCell class. My class has a Combobox as a private member but I am not sure how I can render it. I am overriding the Pain method but I have no idea how to draw the combobox. I set its location ...

How would one get a DataGridViewCheckBoxColumn to show DataRelation status?

Say I have a DataGridView (named dataGridView) that is displaying a Strongly Typed DataTable (named ChildDataTable). dataGridView has a DataGridViewCheckBoxColumn (named parentIDColumn) that is bound to a Field Property ParentID on each ChildDataRow in ChildDataTable. ParentID is a foreign key that relates ChildDataTable to another Dat...

Calculate total hours using DateTime columns in DataGridView

I'm struggling a bit with a calculation I need to do en every row in a datagridview. What I want is to go through all rows in a datagridview that has two columns with datetimes. One representing a LogInTime and one representing a LogOutTime. I would like to get the total number of hours and minutes between all log in times and log out ti...

DataGridView item double click

I have a DataGridView in a Windows Form. I want to handle double click events on each cell to display a detail form related to that record. Unfortunately, the double click event is executed when you double click on column headers. What should I do? ...

GridView in ASP.NET 2.0

How can I populate an editable Grid with data from different tables from MSSQL Server'05 writing a code behind function??? I have used: Dim conn As New SqlConnection(conn_web) Dim objCmd As New SqlDataAdapter(sql, conn) Dim oDS As New DataSet objCmd.Fill(oDS, "TAB") Dim dt As DataTable = oDS.Tables(0) Dim rowC...

Slow performance of DataGridViewRow in .NET C# Application

I'm trying to figure out some behavior in an app that I'm supporting. The snippet is: foreach (DataGridViewRow pGridRow in grdEmail.Rows) { pGridRow.Cells[0].Value = chkSelectAll.Checked; pCount = pGridRow.Index + 1; } Which is essentially trying to select all rows in a grid (check a box) when a select all checkbox is clicked....

DataGridView repeatedly recreating columns

I have a problem when assigning the DataSource propery on a DataGridView control. My DataSource is a DataTable's DefaultView and, as expected, columns are automatically created in the DataGridView to match those in the DataTable when I assign it. What happens next is that the columns seem to be automatically removed and recreated a furt...

Need help editing multiple cells in a datagridview

I am trying to support editing multiple cells on a datagridview. I am nearly complete, as it correctly copies the contents to other cells when the editing is done. What I am working on now is capturing the first key pressed. When I am editing just one cell, using EditOnKeystrokeOrF2 works fine. However, when multiple cells are select...

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 (that's easy) 2) So the columns are lined up such that for any column COL, gridA[COL].Width ...

How can I capture the keystroke that triggers "CellEndEdit" on a DataGridView in C#?

I have a DataGridView that is set to EditOnF2. I do some special processing of data in the CellEndEdit eventhandler that sets the value of the cell. I still want the functionality of the EditOnKeystrokeOrF2 of reverting to the original value when the Esc key is pressed. Unfortunately, at the CellEndEdit eventhandler, I don't see a way...

how to delete row from datagridview with a delete button?

I've got a DataGridView with a BindingSource binding it to a DataTable. I've put a Delete button on my form and I want it to delete the currently selected row when clicked, something like this: if (dgvResourceSettings.CurrentRow != null && !dgvResourceSettings.CurrentRow.IsNewRow) { bindingSource.RemoveCurrent(); } ...

StackOverflowException without recursion or infinite loop?

Hello, Background I have a DataGridView control which I am using, and I added my handler below to the DataGridView.CellFormatting event so the values in some cells can be made more human-readable. This event handler has been working great, formatting all values without issue. Recently however, I have discovered a very rare circumstan...

C# DataGridView Vertical Scrollbar doesn't paint correctly with build file.

I have a DataGridView with both horizontal and vertical scrollbars. When running the application within Visual C# using "Start debugging" everything looks fine, but when running the application itself after building it the vertical scrollbar doesn't paint correctly (it's not really visible but there is space taken up as if it should be...

DataBinding a DataGridview rows BackColor

I have a DataGridView that uses databinding, with manually created columns, and this works fine. However I want the rows' BackColor to be databound as well, and so far my attempts have hit errors. This is my latest attempt: dataGridFileTransfer.RowHeadersVisible = false; dataGridFileTransfer.AutoSizeColumnsMode = DataGridViewAutoSizeC...