Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

DataGrid values

Posted on 2006-05-03
2
Medium Priority
?
180 Views
Last Modified: 2010-04-23
In general, how do I find the value of the cell that has been selected in a datagrid?

Thanks in advance!
0
Comment
Question by:geoffsweb
2 Comments
 
LVL 28

Accepted Solution

by:
iboutchkine earned 1000 total points
ID: 16599430
if it has datasource then
Me.DataGrid1.DataSource = dt
Msgbox(dt.Rows(RowNUmber).Item(ColumnNumber))

or the value of the cell

dg.Item(RowIndex, ColumnIndex)
0
 
LVL 3

Expert Comment

by:maidinhtai
ID: 16607891
Hi geoffsweb, try this example:
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        For Each i As DataGridViewCell In Me.DataGridView1.SelectedCells
            MessageBox.Show(i.Value)
        Next
    End Sub
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question