datagridview

Why is a DataGridView so row-centric?

Why is there a DataGridViewRow.Cells property, but not a DataGridViewColumn.Cells property? What's so important about rows that I'll never want to iterate down a column? I'm not saying that it makes it particularly difficult to do or anything, it just strikes me as oddly asymmetrical. I'm implementing a "fill down" type behaviour, and ...

How update dataset with datagrid view C#

Hi, I am beginner and I have this problem. How can I can update dataset with datagridview? I binding dataset in datagrid. Edit datagrid. At finish I want update dataset with datagridview. Thank you form any advice Sory, I use Winforms. Example: I bind dataset in datagridview. dataGridViewCustomers.DataSource = _ds.Tables[0]; //edit...

Datagridview - Focus on Cell that was right clicked

I have a datagridview that I have put a ContextMenuStrip1 on. I would like it to remove a row in the datagridview when the row is right clicked on and they click on "delete row". I have the delete working and the menu is showing up but this isn't firing when you right click on the datagridview. This is where I am setting the row to edi...

Why am getting concurrency violation error?

I've MS Access db, datagridview that displays items, two checkbox columns that represents Yes/No columns in the db, and refresh/del buttons. When I try to delete a row that its checkboxes hasn't been modified, the row delets just fine, also when I modify the checkbox value, press refresh button, then delete, the row deletes fine too. ...

HyperLinks In DataGridView

I am working on C# application which is like a small search engine. The user will enter a word and the program will return the files that contains this word. I have an array of file paths (as strings) and I want to show these paths as links in a DataGridView, so that when the user clicks the file name the file will be opened. Note: I ...

How to set the pointer to the current row in the Datagridview in C#

I have a datagridview on the Windows Form in c#. I am updating and filling the table adapter on the cell event. The problem is that When I go to lower half of the datagrid which is not visible until I scroll down, as I click any cell, the table adapter is filled and updated and the pointerpoints to the very first row. Any suggestion on ...

How to resize form to fit DataGridView?

I have a form that contains dataGridView, whose coloumn are set to dgrv1.Width =dgrv1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible)+20; I want to make the form to automaticaly follow the width of dataGridView... Also, on maximized, I would like it to grow in height only. Any sugestions? ...

How to give border line in DataGridView.

Can any one help me. how to give border line for the selected cells in DataGridView. ...

Custom control in DataViewGrid

I'm trying to embed a custom control in a Datagridview. I've looked at the Calendar (http://msdn.microsoft.com/en-us/library/7tas5c80.aspx) example but i just cant get it working for a custom control. I need the control to show for each object in the grid. Not just when the user edits the content. I need to do this so that i can bind my...

DataGridView cell not redrawing when value changed asynchronously

I have a DataGridView whose cell values are changed via callback functions that are invoked asynchronously. In one case, I have a callback in the form of an Action<T>. I noticed that if I have a method public void MyMethod(T data) { } and I do: UpdaterObject.AddCallback(MyMethod); it works fine, but if I pass in the callback in this ...

Adding rows to a data-bound DataGridView [Winforms]

I want to bind a table from a database to a DataGridView, but I want to also add one more row with a sum of the values in the columns with indexes 3,4,7,8,9... How can I do that? Thanks! DataTable table1 = new DataTable(); double brutoUkupno1 = 0; double porezUkupno1 = 0; double doprinos...

How to get or set data from ComboBox in DataGridView

In C#.net I want to get or set data to ComboBox in each cell of DataGridView What should I do. Thanks. ...

Bound DataGridView not updating data source

I'm trying to bind a table of structures to a DataGridView. Loading and viewing the table is working fine but I can't edit a value and get it stored back into the table. Here's what I'm doing. I have a "primitive" data type, Real defined by public struct MyReal:IMyPrimative { public Double m_Real; //... public MyReal(Stri...

How to print datagridview (with header vertical alignment) in c#.net ?

Hi, I want to print a datagridview in C#.NET, but the problem I actually want to print its header with vertical rotation only. Please help me ...

Get the corresponding row in the datatable from the selection in datagridview

Hi All, I have a DataTable which is bound to datagridview (Winforms)... I use the following two lines to get the DataRow that is selected in the datagridview... int l_intSelectedRow = DataGridView1.SelectedRows[0].Index; DataRow l_drwSelectedRow = ControlGroupPostedItems.Tables["PostedItems"].Rows[l_intSelectedRow]; ...

Locked DataGridView. Linq is a problem ?

Hi, I get the collection from webservice: var allPlaceHolders = from ph in new MyService().GetPlaceHolders() select new { Code = ph.Code, Name = ph.Name, Related = false }; dgPlaceHoldersAdd.DataSource = allPlaceHolders.ToList(); Designer.cs: this.dgPlaceHoldersAdd.ColumnHeadersHeightSizeMode = System.Windows.Forms.Da...

NHibernate, Databinding to DataGridView, Lazy Loading, and Session managment - need advice

My main application form (WinForms) has a DataGridView, that uses DataBinding and Fluent NHibernate to display data from a SQLite database. This form is open for the entire time the application is running. For performance reasons, I set the convention DefaultLazy.Always() for all DB access. So far, the only way I've found to make this...

How To AutoScroll a DataGridView during Drag and Drop

One of the forms in my C# .NET application has multiple DataGridViews that implement drag and drop to move the rows around. The drag and drop mostly works right, but I've been having a hard time getting the DataGridViews to AutoScroll - when a row is dragged near the top or bottom of the box, to scroll it in that direction. So far, I've...

WPF DataGrid bind data between columns

Lets say I have 2 columns in my data Grid: Column A: Selected, and Column B: Name. The Selected column is a checkbox. And Name column is text field. I want to set the color of the text in 'Name' column as Blue if Column A's check box is checked, and Red otherwise. Essentially I don't know how to bind data between columns of the datagrid...

No cursor when resizing datagridview

When i'm trying to resize datagridview columns the resize cursor appears only when i roll over header. However, when i roll over in between cells, resize cursor doesn't show at all. I have noticed if i set ColumnHeadersVisible = false it fixes the problem and i see resize cursor between columns. However, i need header to be visible, any...