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
1 answer

How can I make a Winforms datagridview expand column widths to fit content?

I need my columns to be only as big as the largest value in that column. Is there a setting somewhere I can set? Thank you.
delete
3
votes
2 answers

DataView doesn't sort ascending or descending in DataGridView

The program runs fine but Ascending and Descending buttons don't do anything. The DataGridView with all the data from a table looks the same and not sorted. It suppose to sort by Title. Maybe it does sort but doesn't refresh the…
HelloWorld
  • 43
  • 1
  • 2
  • 4
3
votes
1 answer

After setting DataSource of DataGridView, Columns and Rows are still empty

I have a DataTable and a DataGridView. I have read this answer but I do not have a DataAdapter so I cannot call dataAdapter.Update(dataTable);. I also read some pages of the official documentation (such as this) but I do not comprehend. Simplified…
silviubogan
  • 3,343
  • 3
  • 31
  • 57
3
votes
1 answer

C# DataGridView : override keydown events

i am working with DataGridView trying to provide specific utility to my user... what i want to do is when some key is presses instead of the normal function that the key was supposed to perform like updown arrows and page up down keys etc i want to…
Moon
  • 19,518
  • 56
  • 138
  • 200
3
votes
1 answer

Creating Dynamic DataGridViewComboBoxCells

So here is my situation. I have a DataGridView, which has two columns that I am trying to set up as DataGridViewComboBoxColumns called "Received" and "Backordered". The point of these combo boxes is to create a drop down menu to select how many…
Skitzafreak
  • 1,797
  • 7
  • 32
  • 51
3
votes
2 answers

Vb.Net update Datagridview in main form when save data in another form

This my function to display data from sql server to Datagridview Private Function getpdfinfo1() As DataTable DataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect Dim dtpi As New DataTable Dim connString As String =…
Hazim Mohammed
  • 107
  • 1
  • 2
  • 10
3
votes
2 answers

Detect column reordering - ColumnDisplayIndexChanged raises multiple times

I am working on a .net 4.6.1 C# winforms project that has a datagridview where users can change the order of columns. I would like to store the new order in a db table, but have trouble finding the right event for detecting when a user changed the…
Montfrooij
  • 85
  • 9
3
votes
1 answer

How to insert multiple rows from datagridview to SQL database in VB.net?

I have made a Form named form1.vb. I have 4 TextBoxes named supid, supname, supmobile, suploc. I have a DataGridView named datagridview1. I am transferring these 4 TextBoxes data in the DataGridView but when I try to send a DataGridView row in SQL…
pankaj babbar
  • 69
  • 2
  • 10
3
votes
2 answers

Is it a good idea to inherit from standard widgets and set my own default values in C#?

When designing app in Visual Studio (C#), if I know that I will have a certain number of DataGridViews that all have same properties (like width, height, color, some other properties like: disable option to directly edit rows, etc.) is it ok to make…
DCH
  • 125
  • 6
3
votes
1 answer

Win Forms DataGridView Horizontal ScrollBar

Is it possible to show permanently the horizontal scroll bar of a DataGridView in Windows Forms 2.0. Like we can do in the horizontal scroll bar of a Panel. Currently, the Horizontal ScrollBar is visible only when the total sum of widths of the…
dan
  • 31
  • 1
  • 2
3
votes
3 answers

c# using advanced datagridview (ADGV) filter without BindingSource

I am using the advanced DataGridView (ADGV) found here to add filtering capabilities to my application. The code for filtering or sorting is mentioned as: private void advancedDataGridView1_SortStringChanged(object sender, EventArgs e) { …
Taher
  • 565
  • 1
  • 14
  • 32
3
votes
0 answers

C# Get deleted items and changed items to list

I have a question to get all deleted items to a new list and also for the changed items. I'm using a datagridview with a sortable bindingsource. For all new items it's already working(last part of the code) Thanks! namespace Levelapp { public…
vanlion
  • 111
  • 8
3
votes
7 answers

C# windows form 2 gridviews with synced scroll

I am developing an application in which two datagridviews are being populated from different data sources. I would like to have a single vertical scroll-bar that will make both gridviews work at the same time (scroll up and down together) can…
IanCian
  • 1,098
  • 2
  • 16
  • 34
3
votes
1 answer

How can I remove unnecessary columns in a DataGridView?

How do I remove the specific column, from a DataGridView control, that is indicated in the picture?
HelloWorld1
  • 13,688
  • 28
  • 82
  • 145
3
votes
1 answer

How to change the committing value in dataGridView?

I have a dataGridView that has a column with checkboxes. Whenever the user clicks on a checkbox I use the event CellContentClick where I process the necessary action. But now, in some cases, I would like the value not to be committed (the checkbox…
Alexandru Pupsa
  • 1,798
  • 4
  • 21
  • 40