datagridview

DataGridView Scroll event (and ScrollEventType.EndScroll)

When handing the DataGridView.Scroll event, you can check whether it was the end of the scroll (when dragging the scroll bar with the mouse, this is presumably when the mouse button is released). The problem is that this never seems to happen. e.Type is never ScrollEventType.EndScroll What's wrong with this? How can I do something only...

Windows Forms - Validate DataGridView input

I have a Windows Forms application with a DataGridView in one of the forms. The DataGridView can insert and update through a Typed Data Set generated by Visual Studio. I want to show user friendly error messages when a user doesnt fill in a required field or enters the wrong data type, etc. instead of the ugly huge one that is shown by ...

DataGridView: How to select first cell in current row when MultiSelect is true

I am creating my DataGridViewEx class, inherited from DataGridView. I want to create a method for selecting first cell in a current row, so I wrote this: /// <summary> /// The method selects first visible cell in a current row. /// If current row is null, nothing is done. /// If any cells are selected, they are unselected befor...

Customize or skin .net DataGridView controls

Hello, does anyone know how easy it is or how possible it is to skin a .net Windows Forms DataGridView control? I'd like to render the control vastly different then what it currently looks like. For example, think of the open source application Boxee. It has a completely custom interface which is how far I'd like to push the control...

Bind Time to a DataGridView with a Date other than Today

We're creating a timesheets application. We're using a bound DataGridView to display the Task, StartTime and EndTime columns. The StartTime and EndTime are saved as datetimes in the bound SQL table. The StartTime and EndTime have their CellTemplate defined as follows, so that they only show the Time part: colStartTime.CellTemp...

Windows Forms - ErrorProvider + DataGridView

How can I hook in the ErrorProvider with individual cells on the DataGridView control? ...

How do I position a DataGridView to a specific row (so that the selected row is at the top).

I have an application with a DataGridView on it and I would like to position the rows such that a specific row is at the top of the list. I don't want a sort, I want a way to programmatically tell the DataGridView "scroll to the Nth row." Any ideas? ...

What is the maximum amount of data that can be loaded into a Windows form control?

Hello, What is the maximum amount of data I can load onto a form control? My application consumes too much memory and hangs when more than 500,000 records are added to any windows forms control in my experience. Any clues? Thanks ...

Ability matrix grid with dynamic loading (WinForms)

Hello, I was requested by a customer to build a grid that represents an ability matrix for actions. For example, each row represents a protocol, and each column represents an action that can be done on it. The grid should not be hard-coded - it should load the relevant actions for the protocols. Meaning, there could be a different amount...

Search datagridview on user keypress

Hi, I'm trying to select the first row where the cell value starts with the same keychar the user pressed. That's the part that is giving me trouble. Here's how I'm handling the event (updated with working solution): private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e) { if (Char.IsLetter(e.KeyChar)) { ...

DataGridView: FullRowSelect and Focus

I've got a DataGridView in a modal window with a list of options for my program. The grid has two collumns. The first one contains a checkbox for selecting that option, the seccond is the name/description of that option. The winform also contains OK and cancel buttons but that's beside the point. The code below does what I want it to. Be...

data grid view is slow

I have a data grid view which is constantly being updated. It doesn't perform the way i would like it to. Can you guys suggest any alternative controls which you think are gonna handle updates faster? Thanks. //////////// no binding. when i use datasource its even worse. i update an element like DepthGridBid.Rows[i].Cells[j].Value...

Sort dataGridView colums in C# ? (Windows Form)

Hello there, I have a datagridview that i bind from an sql table, in that dv i have those attributes: Id, Name and Price. When i set the SortMode of the Name Columns to Automatic and i click on the header of this column i can sort this dv based on the first letter of the Name, this way i can order products based on their first letters ( ...

C# DataGridView AutoSizeRowsMode Problem

I have a DataGridView which I add data to programatically. I have the AutoSizeRowsMode set to AllCells and the WrapMode on RowsDefaultCellStyle set to True. If I add a multiline row to the DataGridView it shows up fine (autoscaling the row to show the multiple lines). However, if I hide the column that has the multiline data (so that the...

DataGridView bound to Linq to SQL does not show new rows added elsewhere to DB context

I have a DataGridView bound to a LINQ to SQL query expression. I want it to be editable for updates, but for inserts I want users to use separate controls below the grid (textboxes, date pickers, etc - currently not bound to anything). I have an "Add" button that creates an object of the linq to sql entity class based on the values in ...

C# Foreach Loop - Continue Issue

I have a problem with a continue statement in my C# Foreach loop. I want it to check if there is a blank cell in the datagridview, and if so, then skip printing the value out and carry on to check the next cell. Help appreciated greatly. Here is the code: foreach (DataGridViewRow row in this.dataGridView1.Rows) { ...

C# AutoSize DatagridView Populated By Linq Query

Hello, I have a datagridview control that is populated by a linq query: public static IQueryable SearchByDepartmentNameInfo(string deptName) { ExamineDataContext dc = new ExamineDataContext(); var queryResult = from q in dc.GetTable<Question>() where q.Topic.Module.Department.DepartmentNa...

DataGridView Get Text From Specific Column Only Help Needed

I have a datagridview that is populated with 4 columns and multiple rows of data. I want to iterate through the datagridview and get the cell value from A SPECIFIC COLUMN ONLY, since i need this data to pass into a method. Here is my code: foreach (DataGridViewRow row in this.dataGridView2.Rows) { foreac...

Generating Columns in GridView ( C#, LINQ )

The situation is, that i need to create table in grid view looking like this: ----------| ID---|---Name--|--1/2002--|--2/2002--|--1/2003--|........| 2/2009 | Cust1--| Cust2--| : : I have two tables in db - Customers and orders, throught LINQ to SQL DataContext ID and Name of the customers i´m getting from a simple query var custInfo = ...

Focus next control when pressing 'TAB' key

I have a DataGridView where I manage manually the focused cells when navigating with TAB key. For example, when the first cell from the last row is the last cell than can be navigated in the DataGridView I want that when pressing 'TAB' the focus to go on the next focusable control (a button). SendKeys.Send("{TAB}") will not work - the f...