[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

datagrid in vb.net

Posted on 2004-03-26
3
Medium Priority
?
732 Views
Last Modified: 2012-05-04
HOW TO RETRIVE  SELECTED ROW VALUES OF A  DATAGRID IN VB.NET(NOT C#OR ASP.NET)
0
Comment
Question by:anu2004
  • 3
3 Comments
 
LVL 3

Expert Comment

by:pamboo
ID: 10693858
To get the selected cell value

 Me.DataGrid1.Item(_dgrid.CurrentCell())

- Rajan
0
 
LVL 3

Accepted Solution

by:
pamboo earned 80 total points
ID: 10693863
Sorry , u asked for the selected row  . The below function will return the datagrid selected row .

Public Function GetSelectedRow() As DataRow

        Dim dv As DataView = _dgrid.DataSource
        Dim dsTemp As New DataSet
        Dim dr As DataRow
        Dim i As Integer

        dsTemp.Merge(dv.Table)

        If Not dv Is Nothing Then

            If _dgrid.CurrentRowIndex <> -1 Then

                dr = dsTemp.Tables(0).Rows(_dgrid.CurrentRowIndex)

                For i = 0 To dv.Table.Columns.Count - 1
                    dr.Item(i) = _dgrid.Item(_dgrid.CurrentRowIndex, i)
                Next                

                Return dr

            End If

        End If

        Return Nothing

End Function

- Rajan
0
 
LVL 3

Expert Comment

by:pamboo
ID: 10693886
say _dgrid is my datagrid control.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
Simple Linear Regression
Screencast - Getting to Know the Pipeline

834 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