Solved

datagrid in vb.net

Posted on 2004-03-26
3
716 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
Comment Utility
To get the selected cell value

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

- Rajan
0
 
LVL 3

Accepted Solution

by:
pamboo earned 20 total points
Comment Utility
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
Comment Utility
say _dgrid is my datagrid control.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
linearIn  challenge 23 65
squareUp  challenge 22 104
bunnyEars challenge 6 62
strCount chalenge 3 50
RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
A short article about a problem I had getting the GPS LocationListener working.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now