datagridview

C# Winforms DataGridView with sorting/filtering like Ms Excel

Hi I need a quick solution to do filtering/sorting using the Winforms DataGridView control just as in Excel. I have reviewed the existing posts on this area but none seems to meet my needs. I am populating my DataGridView manually - no data binding ...

DataTable Column with Custom Data Type

I have written my own data type that is then used as the type for a column in a datatable. I am reading XML data from a file. After I call the ReadXML(file) method, all the cells have values except for the cells in the columns with my data type. Is there some operator I need to override so that ReadXML(file) can take the data from the...

datagridview in c#

Hi, I am able to bind the result of query to datagridview. i.e., SELECT * FROM employee where empid=@empid to datagridview in winform. I need is a code that enables me to update the result of this query on the datagridview & the update to be showed on employee table in my database using c#. Thank you ...

Choosing column from other table/object

I have a DataGridView which DataSource is connected to objects. Everything works OK (I can edit that objects and the change is persisted) until I want to choose using the combobox connected object (in the database it is connected via foreign key). I can fill the combobox so that the proper values are shown (ie. user's name). I do this ...

How can I refresh only the visible rows of a data bound DataGridView?

I have a DataGridView bound to a list of custom objects created on the fly. This list is not very large, 5000 items maximum. However, the values of the custom objects change every 50ms and the grid hangs the application while refreshing the values and it ultimately crashes. My question is: is there a way to "virtualize" the data binding...

custom DatGridView & BindingSource & settings in Designe Mode

Hi, I'm writing my own datagridview. 1. In the VS designer Mode we can pick source of data in "Choose Data Source" (BindingSource). But I have to fill it up in Page_Load whit data. This, however, does not cause loading them to MyCustomGrid control, and so I have to load them into MyGrid.DataSource. In normal dgv this is no longer needed...

Filtering an DataGridView that doesn't have databinding

I have a non databound DGV (no datasource, etc; rows added manually). To filter it I'd been doing a check in a loop and setting the rows visible property appropriately. This worked well with smaller test sets, but fails utterly in performance with larger ones. 1k rows filtered at 5000/sec. 10k rows filtered at only ~250/sec. 50k at ...

Setting Focus on DataGridView Control programmatically in Visual Basic

I want to programmatically set the focus to the last row (bottommost, its only one column wide) in the DataGridView control for Visual Basic. How can I do so? So far, I have tried DGV.Rows.GetLastRow(DataGridViewElementStates.Selected) without success, though I did not expect that to work. It absolutely must select that last cell. ...

winforms datagridview calculated field change event

I have a datagridview bound from a datatable. I have a calculated column linetotal that multiples unitprice * quantity. I also have a totalprice label,that I would like to contain the sum of the linetotal column in the datagridview. When the user makes any changes to unitprice or quantity, the linetotal should update for that line and...

Populate data from dataset and show in datagridview

I am working in vb.net and i have a simple requirement. I have added a MDB file to a dataset and it contains 21 tables. I have a datagridview and a combobox on my form. I was able to get the combobox populated with the table names available in the dataset by iterating through dataset.tables. Now i want to add the feature where the us...

C# - Combine two columns in a datagridview?

Is there an easy way to combine two columns in a datagridview? Hide the two and use their data together in a new one perhaps? Data is coming in from a database. ...

How to get the value of the first column of current row of Winform DataGridView ?

This is something simple yet I cannot find any answer searching google ! I tried this in C# MessageBox.Show(this.DataGridView1.CurrentRow.Cells[0].ToString()); This returns me row and column index not the value of the cell. How to get the value instead ? Thanks. ...

DataGridView display row header cell

I'm trying to display a simple DataGridView linked to a DataTable and I want, ultimately, my first column in the DataTable to be the row header cell for the DataGridView. At this point I will settle for having any value in the row header cell. I can display the DataGridView with all my rows and columns, and with column header cells, bu...

Horizontal ScrollBar in WinForms DataGridView

Hello, I'm using a DataGridView in VB.Net in VS 2005. The issue is, when there are rows that exceed the width of the DataGridView, the horizontal scroll bar doesn't appear (the ScrollBars property is set to "Both"), but an ellipsis appears at the end of each row that is too long. I don't want the ellipsis, but the horizontal scroll ba...

Set DataFormatString on DataGridView at Runtime?

Is it possible to set the DataFormatString property of a column or cell in an ASP.NET DataGridView at runtime? ...

scrolling datagridview inside another scrollablecontrol

Hi Experts, I have a datagridview control within a scrollable control. I am working on an accessibility bug where when user press tab, datagridview should always show active row. Containing control has autoscroll = true and it works great for its children controls but for a child control of its child control, it isn’t working. Does anyon...

DataGridView Control with Grouping Capabilities

I've seem some other posts regarding datagrids that allows grouping. I've downloaded the DevExpress DataGrid for Windows Forms but it really looks complicated. I actually need a Datagrid that derives from DataGridView as a lot of my data binding is code driven and uses the DatagridView classes. I've managed to find this OutLookgrid on C...

Prevent drag/drop from working between seperate instances of an app

I have an app with 2 DataGridView's and have implemented Drag/Drop to allow the user to move data between them. Within the context of my application dragging rows between two instances of a form isn't a meaningful action. I'm not sure how to detect it in drag enter so that I can set e.Effect to DragDropEffects.None. If I don't do so...

Saving the Layout of Data Grid View (width, order) in Visual Studio

I have some data Grid Views and I want the user to be able to keep changes he does to them. Not the Data changes, only the layout changes, like the width, the hight, the order of the columns and maybe the visibility of them. I don't care if it will be automatic or by clicking a button... Edit: I found a way to do this using Settings.I h...

DataGridView CurrentRow excludes new row

I want to get the index of the current row of my DataGridView. The problem is, that if the current row is the new row, CurrentRow is set to the last row that is not the new row. I cannot check for the rows to be selected because if a row is selected that doesn't mean it is the current row and the current row isn't necessarily selected. ...