473,396 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to get the value of the cell in datagridview



Hi

I have a datagrid with 12 columns and various rows...

what I want to do is to get the value of each cell, e.g. column3 row1,
column4 row1, etc..

I was using dataGridView1.Rows[dataGridView1.RowIndex].Cells but I got
an error of System.Windows.Forms.DataGridView' does not contain a
definition for 'RowIndex'

Can someone tell me how can I get the value?
Cheers!

Claudi

*** Sent via Developersdex http://www.developersdex.com ***
Jul 18 '08 #1
2 3085
DataGridView1.Rows[DataGridView1.CurrentRow.Index].Cells[0].Value

or

DataGridView1[0, DataGridView1.CurrentRow.Index].Value

or

DataGridView1.CurrentCell.Value

Jul 18 '08 #2
On Jul 18, 5:59*am, Claudia Fong <cdolphi...@yahoo.co.ukwrote:
Hi

I have a datagrid with 12 columns and various rows...

what I want to do is to get the value of each cell, e.g. column3 row1,
column4 row1, etc..

I was using dataGridView1.Rows[dataGridView1.RowIndex].Cells but I got
an error of System.Windows.Forms.DataGridView' does not contain a
definition for 'RowIndex' * * *

Can someone tell me how can I get the value?

Cheers!

* * Claudi

*** Sent via Developersdexhttp://www.developersdex.com***
RowIndex is a property of the Cell, not of the grid.
You can use DataGridView.Rows to get the collection of the rows, then
use the Cells property of each row:

DataGridView1.Rows[ X ].Cells[ Y ]
returns the column Y of the row X
Jul 18 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DraguVaso | last post by:
Hi, I'm using the DataGridView in VB.NET 2.0. The DataSource is a Generic List of a custom class0: lstMyPersonnes = New List(Of clsPersonne). When I add a new clsPersonne to lstMyPersonnes,...
2
by: Bob | last post by:
I need to check if there has been a difference between the old value in a call of a datagridview and the new value after the user changed a selection in a combobox in the datagridview. I can find...
1
by: Morten Snedker | last post by:
How do I the value of a cell in a datagridview, before it is updated? I wish to validate the "visible" value, not the actual value (cell/row hasn't been updated yet). Thanks in advance. ...
10
by: steve | last post by:
Hi All I would like to be able to change the cell borders on certain cells to none at runtime to make a group of cells appear to be merged I have tried the following in the cellformatting...
3
by: Henry Jones | last post by:
I am using VB.NET VS 2005 and I have a datagridview bound to a table. This table has rate information on bank loans. The fiels are ProductName, MinDeposit, Rate, and PreviousRate On the grid...
1
by: Dranizz | last post by:
I want to set the value of a cell in a datagridview. DatagridView.CurrentRow.Cells(CEllName).value = "Blabla" When I do this in code and when it's the first cell I edit in a new row, it does...
1
by: PawelR | last post by:
Hi Group, In my application I have DataTable which is displayed in DataGridView via DataView: DataView myView = new DataView(myTable); myDataGridView.DataSource = myView; One column im...
1
by: Roach | last post by:
VB.NET 2005 2.0 Framework application is using a DataGridView for SQL data access and user data entry. As part of exception/error handling, the app wants to advise the user when he/she enters a...
0
by: hydro123 | last post by:
I am using VC++2008 and am trying to read data enetered in unbound datagridview to implement in function. Under button_click event I entered the following: // initialize varaibles from...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.