datagridview

How to get a specific cell in a DataGridView on selection changed

With a listbox, I have the following code to extract the item selected: private void inventoryList_SelectedIndexChanged(object sender, EventArgs e) { String s = inventoryList.SelectedItem.ToString(); s = s.Substring(0, s.IndexOf(':')); bookDetailTable.Rows.Clear(); ... more code .....

Is there a control which emulates Excel functionality but is not Excel?

I'm creating a VB.net application with VS2005 which, at the moment, uses the DataGridView to emulate Excel style functionality on a very basic level. Before I go crazy with creating custom methods for the DataGridView to do some more advanced things, does anyone have a suggestion for an alternative? I plan on installing my app on machine...

How to change the row position of virtual mode DataGridView?

How to change the row position of virtual mode DataGridView? I am using Windows Forms. ...

DataGridView, BindingSource and sorting in vb.net

I am emulating the functionality of an old app in VB.Net. I have a DataGridView on my form which is bound to a BindingSource. I have a button on the toolbar which lanuches a sort dialog. The sort dialog allows sorting by up to 3 columns. So I'm building a string from the results of the dialog and setting the BindingSource.Sort prop...

Can I make DataGridView.EndEdit trigger the CellValidating event?

I'm using a DataGridView in my WinForms application. My main objective is to make the Enter key not move to the next row in the grid. I still want the enter key to validate and end edit mode. I found this FAQ entry and subclassed DataGridView to override ProcessDialogKey(). If the key pressed is Enter, I call EndEdit(), otherwise I call...

C#: Custom sort of DataGridView

I need to sort a DataGridView with Natural Sorting (Like in Explorer) so that numbers and text (in the same column) are sorted naturally, and not alphabetically (so that "place 3" comes before "place 20", etc.). I have a DataGridView, where I have set a DataView as DataSource. The DataView contains a DataTable which is created with some ...

What's the best way to get the DropDown event of a ComboBox in a DataGridView.

Say I have a DataGridView in which I dynamically build up a ComboBox column and add values to it. What's the best approach to trapping when the user clicks on the drop down button to show the drop down list. If I simply use CellClick on the DataGridView, I get that event even if the user doesn't actually click on the drop down button. S...

Can I bind multidimensional data to a DataGridView in C# and .NET?

I'm looking to develop an app which features worksheets subclassed from DataGridView. Users can paste (or import) CSV-like data into the worksheet and it will be reflected in a data structure in memory - my first guess would be a 2D array of floats. DataGridView can be bound to objects with a certain set of interfaces (i.e. IList, ILis...

Bind child Properties to DataGridView

Is there a way to bind the child properties of an object to datagridview? Here's my code: public class Person { private string id; private string name; private Address homeAddr; public string ID { get { return id; } set { id = value; } } public string Name { get { return name; } ...

datagrid in c#.net

how to delete data from datagrid,edit,select,update data from datagrid and ask for a message to do that. ...

How to allow my control to detect the Escape key before the DataGridView close my control?

I have a control with an undo feature, when the user press Escape the control will revert the original value. The problem is when I integrated my control to DataGridView. The DataGridView "eats" the Escape key, hence my control cannot detect the Escape key. When I put "return true" on EditingControlWantsInputKey, my control was able t...

Datagridview custom vscrollbar

I would like disable vertical scroll bar in datagridview and managing the scrolling using separate vscroll control. I am using c# 2.0. Any one can help....???? ...

How to populate each DataGridViewComboBoxCell with different data?

i have two DataGridViewComboBoxColumn that i add at run time i need the items of the first DataGridViewComboBoxColumn to stay the same in all the rows of the gridview but i want the items of the second DataGridViewComboBoxColumn to be different from row to the other depending on the selected item of the first DataGridViewComboBoxColumn ...

grid view combobox

how to add items to a data grid view combo box ...

Linq to Entities, EntityReferences and DataGridViews

I am trying to select certain fields from my entity to be used as the datasource for a datagridview, but I haven't been able to make it work. Is such a thing possible? For example, I have a Customers entity that contains several entityreferences. I want to take fields from the customers entity and from within those entityreferences an...

What's the best way of forcing a DataGridView Cell to accept numeric input only?

Currently I'm using: Private Sub dgvStock_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgvStock.CellEndEdit Select Case Me.dgvStock.Columns(e.ColumnIndex).Name Case "Quantity", "Unit Cost" If Not IsNumeric(Me.dgvStock(e.ColumnIndex, e.RowIndex).Valu...

DataGridView: Which Event do I need?

I have the DGV bound to data and all the other controls properly. What I am trying to do now is update a PictureBox based on the contents of the data row. The picture is not a part of the bound data, its always available on the web. I have a function that will build the url string to a webserver with the images I need. The problem is t...

Check if a DataGridView/BindSource have changed data (VB.Net)

I have a WinForms app with a datagridview and a bindingsource. I want the user to confirm changes before I save them to the database. I don't want to pop up the confirmation dialog unless I know the user has made changes. So I need a way to check if changes have been made. Any suggestions? ...

testing datagridview with windows.automation

Hi i want to test my datagridview validation with the windows.automation. the problem is i dont know how i can do this can someone give me a hand with this? ...

C# - Lambda syntax for looping over DataGridView.Rows

What is the correct lambda syntax in C# for looping over each DataGridViewRow of a DataGridView? And as an example lets say the function makes the row .Visible = false based on some value in the Cells[0]. ...