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

how to give values from xml file to datagridviewtextbox in C#?

lets say i got some xml file which looks like this: Server1 Database1 Server2
Anon1139
  • 55
  • 2
  • 5
4
votes
1 answer

Creating a DataGridView with a Radiobutton column

I'm trying to create a DataGridView column hosted with Radiobuttons. I've been following this MSDN article. Although I have changed the code from the tutorial to write my own classes, it doesn't work as expected. The thing is I'm not entirely sure…
Isuru
  • 30,617
  • 60
  • 187
  • 303
4
votes
2 answers

Saving Dataset to database

I am trying to save a dataset to a database. I got a dataset from another class, Now changes will be made on the form by a user on a datagridview, then the changed Dataset needs to be saved in the database. I am using the below code; Its not…
Saad Farooq
  • 977
  • 2
  • 13
  • 26
4
votes
2 answers

DataGridView autoComplete comboBox column not retaining values on initial cell leave

I have a bound dataGridView with an autoComplete combobox column and the autocomplete is working except that am observing one behaviour thats abit irritating. When i type text in the autocomplete cell for the first time and move to the next cell…
4
votes
11 answers

devexpress gridView.Rows?

I want to do it with Devexpress extension (gridview) : string dataInCell = dataGridView1.Rows[i].Cells[j].Value.ToString(); Like : gridView1.Rows[i].Cells[j]
AhmetSem
  • 41
  • 1
  • 1
  • 3
4
votes
1 answer

Winforms autoscroll getting lost when controls resize

I have a user control that display a passenger car seating layout. It simple draws several "SeatControl" in a matrix like fashion, depending on the passenger car size. For better viewing, the main control resizes the "SeatControl" for fitting all…
bcsanches
  • 2,362
  • 21
  • 32
4
votes
3 answers

Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound

I have a grid and when data is loaded in grid; I simply select a row and press edit button. On edit, new sub form is opened and values of row's cells are passed to controls on sub form. But, when I change some values on sub form and save them to be…
Itz.Irshad
  • 1,014
  • 5
  • 23
  • 44
4
votes
2 answers

How do I bind a DataGridViewComboBoxColumn to a property/method of an object that returns a list?

I have a custom object with several properties, one of which returns a list. This is the code for the object: public class SearchResult { private int eventId; private String eventTitle; private int startDate; private List
Ricardo Altamirano
  • 14,650
  • 21
  • 72
  • 105
4
votes
2 answers

DataGridView SLOW when assigning value to cell

I can't seem to figure out what's going here...I have a dataGridView with no more than 500 rows at any given time but usually around 200 or 300. I iterate through the grid and set the button text and color according user interaction. Example: using…
Max Eisenhardt
  • 442
  • 2
  • 9
  • 20
4
votes
4 answers

Delete multiple rows in a DataGridView(table)

I have a datable "myTable", which is bind with a DataGridView "dgv". The DataGridView "dgv" has a checkbox column. My goal is to delete rows checked in a button event. The datatable is updated of course. Now my code is only working for deleting one…
user1108948
4
votes
2 answers

Setting DataGridView Row Heights Fast

I have a virtual datagridview that I want to set varying row heights for. I was hoping to find a method for setting all the row heights at once, rather than looping through each one at a time. This is the method that I tried to set the heights, but…
ChandlerPelhams
  • 1,648
  • 4
  • 38
  • 56
4
votes
3 answers

Custom NumberFormatInfo on DataFormatString

I have an ASP.NET Gridview with a BoundField that is bound to a decimal value. I use the following code to format the decimal number to a currency value: DataFormatString="{0:C}" We have a custom implementation of NumberFormatInfo though, which…
staterium
  • 1,980
  • 2
  • 20
  • 32
4
votes
1 answer

Binding class with master/detail into two datagridview

I had made a class in C# Windows form to represent my database. It has a master/detail using List<> A record with Employee profile with Trainings(master) and TrainingDetails(detail) Now, how can I display this into 2 datagridview that whenever I…
Gerie Tanabe
  • 147
  • 3
  • 10
4
votes
4 answers

Get value in specific column in DataGridView

I have a datagridview in my Winforms Application. The user can click anywhere on the datagridview And then click a button to perform an action on that datarow However, in order to do this I need to recover the ID from that row Now bearing in mind…
PJW
  • 5,197
  • 19
  • 60
  • 74
4
votes
5 answers

Why does DataGridViewComboBoxColumn display a ValueMember?

I have a small problem. DataGridViewComboBoxColumn displays a value from ValueMember and not from DisplayMember. The grid works fine and when I select something from this column I see the DisplayMember value, but when the focus gets lost, the grid…
wertyk
  • 410
  • 10
  • 30