Questions tagged [datagridview]

DataGridView is a Windows Forms control used to display and edit tabular data.

DataGridView is a Windows Forms control found in the .NET Framework starting at version 2.0. It is used to display and edit tabular data from many different kinds of data sources. It provides a rich set of features such as sorting, filtering, grouping, and editing data.

Useful links

20349 questions
3
votes
2 answers

DataGridView Event Before DataSource Changes

Is there someway I could trigger DataSourceChanging event in DataGridView. The DataGridView has DataSourceChanged event which (I believe) after DataSource is bound to the DataGridView. I want to do some stuff before the property gets changed. A…
The King
  • 4,600
  • 3
  • 39
  • 58
3
votes
2 answers

DataGridView rightmost column user increase size not working

I have a strange issue with a DataGridView on a WinForm. I can resize all columns via mouse, but for the rightmost I can only shrink and not increase the size. Does anyone know how to solve this?
3
votes
1 answer

add new row to datagridview programmatically

I try to add new row to datagridview ,I try by using this code DataGridViewRow row = (DataGridViewRow)dgv_OfferTerms.Rows[0].Clone(); row.Cells[0].Value = cond.Id; row.Cells[1].Value = cond.Name; row.Cells[2].Value = cond.Title; row.Cells[3].Value =…
3
votes
9 answers

Programmatically uncheck checkboxcolumn in datagridview

How can I programmatically uncheck all rows in a DataGridViewCheckboxColumn in a datagridview? I can get the correct value of the checkbox using (bool)row.Cells[CheckBoxColumn.Index].FormattedValue but that's only a getter. I have tried setting the…
Awesome
  • 325
  • 3
  • 6
  • 14
3
votes
2 answers

How to maintain formatting after user sort columns in gridview

When I fetch data from the database the rows are colorcoded. However when the user clicks on the columns to sort the color formatting is discarded and all the rows become white. I've searched for answers and found some people with the same issue as…
3
votes
1 answer

DataGridViewCellStyle how to style button?

I'm a beginner in C# and I'm trying to style a DataGridView button in Windows Forms. I don't know how to, as example, remove the border from a button or change the hover color. Many configurations that are on a normal button are missing in the…
user8757849
3
votes
2 answers

DataGridView cell click event in VS 2010

I am a tad new to the DataGrid controls, but I am just curious as to why the first code block below works, but the second code block does not? (Only thing I can see is the Handles DataGridClaims syntax Block 1 Private Sub…
user279521
  • 4,779
  • 21
  • 78
  • 109
3
votes
1 answer

get single primary key value from datagridview in c# windows forms

I need to get the primary key value, or whatever key I set, from the selected row in a datagridview with out having to create a hidden column. I want the functionality of gridview in asp.net having the DataKeyNames property
Panagiotis Lefas
  • 1,113
  • 2
  • 12
  • 24
3
votes
2 answers

How can I make the DataGridViewTextBoxColumn wrap to a new line if its text is too long?

My question is simple, but I can not think of an easy solution. Lets say I have a DataGridViewTextBoxColumn. How can I make it break text into several lines if it is too long to be shown in one line?
IordanTanev
  • 6,130
  • 5
  • 40
  • 49
3
votes
1 answer

ORM, DataBinding to DataGridView: inserting/deleted new rows not saved to the database

I'm pretty new to ORMs, and I'm currently giving Telerik OpenAccess ORM a try but the question may actually not be specific to that ORM, and I've not yet completely settled on that ORM yet anyway. What I'm trying to achieve is to bind a DataGridView…
Kharlos Dominguez
  • 2,207
  • 8
  • 31
  • 43
3
votes
1 answer

How save changes to a database after IBindingSource.AddNew() method is used

I have a form that I use for both editing and inserting new users into a database. I use Entity Framework 6. All my controls (textboxes and one combobox) are bound to specific binding sources so when I update an entity with: context.user.add(user);…
Whirlwind
  • 14,286
  • 11
  • 68
  • 157
3
votes
1 answer

How to set up the event Datagridviewcombobox cell selectionchanged?

I have a DataGridViewComboBoxCell control with some items into it. I would like to get the values when user chooses a value from the dropdown. I cant use DataGridViewComboBoxColumn where EditingControlShowing can be used. I need similar event…
3
votes
0 answers

Populate multiple Datagridviews with streaming data

I have being battling with this problem quite a few days. It seems every single example i have seen relies on present data. But in my case i have a stream that is processed and splitted into a number of string Arrays and with these i populate my…
John
  • 974
  • 8
  • 16
3
votes
1 answer

Could not determine metatable error binding list to asp.net datagridview

I am working with the following block of code ... List themeList = (from theme in database.Themes join image in database.DBImages on theme.imageID equals image.imageID into…
user26901
3
votes
2 answers

Display properties of child object in Datagridview

How can I display in a datagridview selected properties of an object, and also selected properties of a member object of this first object? I think I will not require binding but rely on hard coding updates, because the updates will initiate on…
bretddog
  • 5,411
  • 11
  • 63
  • 111