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

DataGridView HeaderCell doesn't show value when it's a numeric type

Can someone explain to me why this code dataGridView1.Rows[0].HeaderCell.Value = 10; shows nothing while this one dataGridView1.Rows[0].HeaderCell.Value = 10.ToString(); works correctly?
FateOri
  • 79
  • 1
  • 9
3
votes
2 answers

Convert hhmm DataGridView cell value to TimeSpan field

I want to display a TimeSpan field in a DataGridView column as hhmm. And allow the user to edit it in this format. As far as I understand, I need to add some logic to CellFormatting, CellParsing, and CellValidating events. So I guess I must check…
bretddog
  • 5,411
  • 11
  • 63
  • 111
3
votes
3 answers

How can I use a right click context menu on a DataGridView?

I've created a context menu, and associated to my DataGridView control. However, I noticed that when I right click on the control, the selection in the dataGridView isn't changed. So I can't correctly fetch the row in the context's event…
Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257
3
votes
1 answer

Windows Forms application: help text on a grid view

I am working on a Windows application in C# using a DataGridView. How do I add a help text to appear when the user hovers over the columns?
Gainster
  • 5,481
  • 19
  • 61
  • 90
3
votes
1 answer

Create a Tiff Bitmap file from a DatagridView

I want to create a Tiff file from a Datagridview. I was able to get the Datagridview to a Tiff file, however I just want the Rows and Columns and nothing else. Is this possible without using 3rd party Tool? Private Sub Form1_Load(sender As Object,…
CodeMonger
  • 347
  • 1
  • 4
  • 16
3
votes
2 answers

DataGridView - setting object's displayed value in a column

I bind some collection to a DataGridView. Collection contains KeyValuePair objects where key is a string and value is an object of my class Field. DataGridView displays two columns - one containing the key and the other one containing the value. The…
agnieszka
  • 14,897
  • 30
  • 95
  • 113
3
votes
1 answer

Windows Forms 3.5 how to scroll a DataGridView vertically via code

The client wants to be able to type a letter and have the system scroll the DataGridView such that the first row with a cell that matched the letter will scroll to the top of the DataGridView Any suggestions will be appreciated
Alex D.
  • 31
  • 1
3
votes
2 answers

How to get the data in DataGridView?

How to get the data of specific rows? Now, I used a control "DataGridView" to load the data from "local db". How can I read the data of singular row in the DataGridView? This Question deserves the light of day so here is the process I have a…
大陸北方網友
  • 3,696
  • 3
  • 12
  • 37
3
votes
3 answers

How to update DataGridView correctly, so GUI doesn't freeze

I have a backgroundworker, which does some calculations and reports progress result as string. This string needs to be inserted into dataGridView. But while inserting values, GUI freezes. private void bckgrSorter_DoWork(object sender,…
andree
  • 3,084
  • 9
  • 34
  • 42
3
votes
1 answer

Howto add a row with horizontally merged cells to DataGridView

I'm using WinForms. How to add a row with horizontally merged cells to DataGridView? Something like WorkingTime and Touchdown Count cells on the following picture:
bairog
  • 3,143
  • 6
  • 36
  • 54
3
votes
6 answers

What would be a good way to collect data from the command prompt in a C# Winforms Application?

This is my first day on StackOverflow as a member, and I have to say I've enjoyed how well the idea behind this website works! Anyway, the question: I am creating a C# Windows Forms Application that keeps an eye on all of the network statistics of a…
Jared
  • 4,240
  • 4
  • 22
  • 27
3
votes
1 answer

How to optimize the performance of DataGridView

I have a DataGridView control on my windows application form. This DataGridView is populated on the basis of a plain text file (specified by user at run time). Hence the number of columns and rows are calculated dynamically. Now the every thing…
Jame
  • 21,150
  • 37
  • 80
  • 107
3
votes
3 answers

DatagridView in Winforms , Is SqlDataReader automatically closed on end of loop?

int a ; SqlCommand cmd = new SqlCommand (" Select * From items order by ItemID ", conn ); SqlDataReader reader = cmd.ExecuteReader(); while(reader.Read()) { a = reader.GetInt32(0); if (reader.HasRows == false) …
sqlchild
  • 8,754
  • 28
  • 105
  • 167
3
votes
3 answers

Totals Row in a DataGridView

I am developing a winform application application. I wanted to show sum of columns in last row of each column. This row must always be visible. At moment I am thinking about adding another datagridview just beneath my datagridview with records, and…
fawad
  • 179
  • 2
  • 3
  • 9
3
votes
2 answers

Binding Custom List Property To DatagridView

I have a problem that is difficult to explain. Essentially I have a list of a certain class we can call MyObj. One of the properties of this object is a custom list itself. I would like to bind this List to a dataGridView and have this particular…
Steve Kiss
  • 1,108
  • 3
  • 13
  • 24