datagridview

Problems submitting DataGridView changes with Linq-to-SQL

I'm trying to implement database value edition through a DataGridView control but honestly I'm having a hard time trying to accomplish that. I'm basically using LINQ-to-SQL classes and events, the following being the most significant snippets: var data = from q in data.FOOBARS select new { ID = q...

DataGridView Custom Column with databinding support, unexpected behaviour on initial load.

I am trying to load a custom column (code below) in datagridview in winforms, the custom column binds a integer value into it and displays the integer value along with a unchecked checkbox in it: public class LabelledCheckBoxColumn : DataGridViewCheckBoxColumn { public LabelledCheckBoxColumn() { this.DefaultCellStyle.Ali...

Scrollbar loses focus when datagridview refreshs its content.

my DataGridView refreshes after one second its content. the refresh is triggered via a thread/invoke. when i grab the scrollbar and the refresh starts i lose the focus and i have to regrab the scrollbar again. doing that every second is quite annoying. has anyone a hint how to do it that way i dont lose the focus? as a concrete example, ...

Changing cell type in DGV from ComboBox to TextBox only works for row 0 !?

Hi All, I have struggled all day trying to make my DataGridView behave. I'm using the following code to change a ComboBox cell to a TextBox, when user selects entry It works beatifully for row 0, but for all other rows, the ComboBox remains on the screen, even though debugging says it's a TextBox cell! (inspecting CurrentCell). Does...

Comparing AJAX Treeview & GridControls from different vendors. Whose is better?

I've been working exclusively with ComponentArt controls and want to know what else is out there. What Grid and Treeview controls are worth investigating? It doesn't matter if I need to pay for them... quality, speed, and reliability are key. I've seen a few issues with the CA Grid Control has issues with setting the column width dy...

CRUD in Winforms with linq-to-sql

I have a simple winforms application that I am connecting to my database with linq-to-sql. I have generated the classes directly from the database, and I have a DataAccess class that wraps my datacontext and can give me whatever I need. I have a view that uses an object datasource to populate a DataGridView and a set of related text fi...

Concurrency violation: the UpdateCommand affected 0 of the expected 1 records.

Hello everybody, I am new to c# and try to bind a datagridview to a mssql database in visual studio 2010. The databindings are OK and everything seems to work. Except for a few strange errors: I get the error in the subject after: updating the same row 2 times, deleting a new inserted row, after updating a row when an other row was d...

While in edit mode, advance to next cell and stay in edit mode for VB.NET DataGridView?

I have a DataGridView in which one column has data that the user needs to align by adding spaces. For example, the first two rows might contain: kumbu kuimbiu And the user needs to be able to line up the letters that match by adding spaces. Something like this: ku mb u kuimbiu Now in order to do that with the DataGridView, the us...

How to write every time to a new row of data table?

How can i insert each time a diffrent row in datatable? The data table is used in a dataGridView to write a log. I need each time to write in a diffrent line (row) in the datatable, when I can't know how many rows I need in runtime. Another thing; the datatable is loaded from a XML file, so there might be already rows in the data table. ...

c# add values/show to DataGridViewComboBoxColumn

hello, I have a DataGridView which has different rows and columns and it work perfectly when I add values to it so I have dgv is a DataGridView and the following line working perfectly dgv.Rows.Add(setting[0], StringToInteger(setting[1]), setting[2], setting[3], setting[4]); now the new change is setting[0] it was text cell, now i...

Update DatagridView Cell Background color based on row data

Hi I got a DatagridView and I would like it to change background color depending on the data in each row. Ex. | Person 1 | Person 2 | Person 3 | |----100----|---200-----|-----150----| |----300----|---100-----|------50----| In the first row I would like it to make "100" have a red background color and "200" green. Or. The lowest val...

How Bind Image and text in a datagridview column?

Hello Everyone For my application I need to put Icon and Text in the same datagridview column. Please help me. ...

Newline in datagridview cell vb.net

I'm trying to insert a new line in a cell of my datatable. When I hover the cell it shows it like it should. Everything has a new line. Otherwise in the gridview I see the string in 1 line. Dim info As String = dttopdrachten.Rows(j).Item(0).ToString & vbCrLf & dttopdrachten.Rows(j).Item(2).ToString & vbCrLf & dttopdrachten.Rows(j).Item...

DataGridView Place a frozen column to the far right

I have a DataGridView in a WinForms 2.0 App that has a lot of columns, enough that even when maximized the user has to scroll to see all columns. The far right column is a delete button. We want to always display the delete button without the user having to horizontally scroll. When I try setting column.Frozen = true; it removes my ho...

Setting the ReadOnly property on derived DataGridViewCells

This is either me not understanding the order of constructor execution or not understanding the precedence of ReadOnly fields on DataGridViews. class Form1 : Form { public Form1() { DataGridView gv = new DataGridView(); Controls.Add(gv); gv.Columns.Add("foo","foo"); gv.Rows[gv.Rows.Add()].ReadOnly...

DataGridView Sort repositions the horizontal position of grid slightly

I have a DataGridView with a lot of columns which causes a horizontal scrollbar. However, when I scroll all the way to the right and sort on a column the datagridview slightly repositions itself, but the scrollbar remains all the way to the right. I want to stop this behavior and keep the grid in the same position it was in before the ...

Paging with datagridview in asp.net works only from 2nd time

Hi, I have datagridview with paging enabled. But when I want to move from page to another page in the grid, then it only works when I press the 2nd time on some other page. I read some on the internet that I need to bind the data of the gridview but the thing is, I cant bind the data again because the gridview was filled with data in t...

How do I allow user to filter DataGridView (Linq to SQL, Winforms)

How do I allow user to filter the DataGridView with a Linq to SQL source? I want to allow the user to filter on any field, like you would expect from Access or Excel. With datasets, I could build up a query string and use that as a BindingSource filter. What's a good way do do the equivalent with Linq to SQL? I could write a LINQ que...

DataGridView and GenericDataGridView

Is there a control called GenericDataGridView and how do I add that to Visual Studio 2008 so I can use it in my c# application? ...

C# Write/Read GridDataView to XML ?

Hello, I created a DataGridView and I Configured it! how I can save all what the user input in XML file (settings.xml)? so next time the user run the program it will read all the data and view it in the GridDataView the data will not be that much, it is just some kind of settings! I found allot of tutorials online, but they either doe...