Questions tagged [datagridviewrow]

Represents one row in DataGridView

Learn more about DataGridViewRow on MSDN.

110 questions
30
votes
28 answers

VB.NET: Clear DataGridView

I've tried - DataGridView1.DataSource=Nothing and DataGridView1.DataSource=Nothing DataGridView1.Refresh() and DataGridView1.RefreshEdit() None of them works.. I've written a method that sets the DataSource of the DataGridView when executed. but…
Bibhas Debnath
  • 14,559
  • 17
  • 68
  • 96
20
votes
4 answers

var won't work with DataGridViewRow

I new to C# and have a question regarding the use of "var" When I use the following code everything works great foreach(DataGridViewRow row in myGrid.Rows) { if (row.Cells[2].Value.ToString().Contains("51000")) { row.Cells[0].Value =…
Joaquin
  • 205
  • 2
  • 5
19
votes
5 answers

How to set Cell value of DataGridViewRow by column name?

In windows forms, I'm trying to fill a DataGridView manually by inserting DataGridViewRows to it, so my code looks like this: DataGridViewRow row = new DataGridViewRow(); row.CreateCells(dgvArticles); row.Cells[0].Value =…
user2612401
9
votes
5 answers

Preventing a new row from appearing in a DataGridView before current row is filled in?

I have a DataGridView in my WinForm application in C# 3.5. AllowUserToAddNewRow property is set true. When user types any text in DataGridView, another new row is automatically added to DataGridView. I do not want this new row added until some…
Haider Ali Wajihi
  • 2,756
  • 7
  • 51
  • 82
8
votes
2 answers

Datagridview SelectionChanged event based on row selection

I have a DataGridView on a TabPage. When the user clicks on a row, a second DGV appears. Each row is associated with its own DGV filled with data. What I want is for when the user goes from one row to another, the DataGridView changes too. So far…
Tatiana Laurent
  • 281
  • 1
  • 4
  • 13
5
votes
1 answer

How to detect if a mouse event is on the row divider or on the row itself

I have a DataGridView with rows that I group based on group number. To visually separate the rows of different groups, I set the DividerHeight of the last row in a certain group. I want to implement a different behaviour for mouse events for row…
5
votes
3 answers

DataGridView Preserve Selected Index and Scroll Position after update and reload

I have some problem, don't now how to preserve the scroll position in a DataGridView. I have over 1000+ rows and scrolling back to edited row is painful. How can I preserve the scroll position and scroll to the edited row after refreshing data?
sokol
  • 79
  • 1
  • 1
  • 4
5
votes
5 answers

How to drag and drop row within the same datagridview

In a Windows App (Visual Studio)(VB) how do you drag and drop a single row to another postition to allow for the user to re-order the row? I haven't found any worthy examples for this yet.
4
votes
1 answer

Using a dynamic list of Custom Object and can't dynamically change dataGrid's cells properties

I am new to posting on Stack. I have searched for quite some time to a problem similar to mine. I am trying to change the checkboxes in a WinForms DataGridView from not read-only to read-only based on the object's boolean value dynamically. It…
patL
  • 53
  • 5
3
votes
1 answer

Faster Method to Making DataGridViewRow's non-Visible

I'm using the following code to set a bunch of DataGridViewRow elements to be invisible. The rule I am using is to check the associated datasource for a boolean flag. If the flag is true, the row will be displayed. If not, it will be invisible. The…
Kashif
  • 865
  • 2
  • 12
  • 33
3
votes
1 answer

Get max DataGridViewRow based on Record ID using LINQ

I am trying to get the DataGridViewRow with the max record id value. I am able to get the record id itself but I need to find the row itself. This is my code for getting the max record id and it works fine: var addedRow = …
ehh
  • 3,412
  • 7
  • 43
  • 91
2
votes
2 answers

How can we make a regular button disabled until the entire dataGridView is completely filled with valid values in C#

I have a datagridview for which I have included couple of validations like cell value not empty and cell value should be in the range of (1,9). I also wanted to make sure a compute button is enabled only after the entire datagridview is filled with…
2
votes
1 answer

How to replace the entire row value in DataGridView?

Is it possible to replace an entire DataGridViewRow value in one line of code? Dim dgvR As DataGridViewRow = dgvExcelData.Rows(i) '[...] Dim row As String() = New String() {a,b,c,d,e} I don't want to replace like this: dgvR.Cells("xxx").Value = a
KSA
  • 675
  • 1
  • 5
  • 9
2
votes
1 answer

c# winforms datagridview add row

c# windows forms i have a datagridview and two columns are present which are created at form design time. i fetch the data from a table and want to add the data row-wise into the grid. i could do it in two ways 1. for every row in the…
johnsonpinto
  • 61
  • 2
  • 9
2
votes
3 answers

C# - How to pass the data from dataGridView1 to another using a button click?

I have a dataGridView1, dataGridView2 and a ButtonAdd in one Form. The user will: 1- select any one "Cell" or the "entire Row". 2-select multiple Rows Then: the data selected will be moved from dataGridView1 to dataGridView2 when the button clicked.…
Mahmoud Ayman
  • 1,157
  • 1
  • 17
  • 27
1
2 3 4 5 6 7 8