Results 1 to 7 of 7

Thread: Highlight Datagrid row based on a column value

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2000
    Location
    Scotland
    Posts
    184

    Question Highlight Datagrid row based on a column value

    I've searched for this in the forums but could not find an answer, can anybody help?

    I want to Highlighting a Datagrid Row based on a column value

    I've refreshed my DataGrid and now I want to go to the row that contains a specific value.

    ie, 2 Columns NAME, ID

    1000 rows.

    I want to highlight the Row with ID = 700

    This does not seem to work:
    Code:
    Dim x As Integer
            '
            ' the count of rows is in the Tag.
    
            For x = 0 To CInt(dgMPANS.Tag) - 1
                If CType(dgMPANS.Item(x, 1), String) = strSelectedMPAN Then
                    dgMPANS.CurrentCell = New DataGridCell(x, 1)
                    Exit Sub
                End If
            Next

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    top of the mountain
    Posts
    234
    I think this is solution for you:
    http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q745q

    regard j

  3. #3
    New Member
    Join Date
    Sep 2009
    Posts
    3

    Re: Highlight Datagrid row based on a column value

    Hi there

    I also face the same issue but the link supplied by you doesnt work anymore.

    If anyone has soluton to this problem please post it here

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Highlight Datagrid row based on a column value

    Quote Originally Posted by ibuksh View Post
    Hi there

    I also face the same issue but the link supplied by you doesnt work anymore.

    If anyone has soluton to this problem please post it here
    Back when this thread was created the DataGridView control didn't exist and this question was for the DataGrid control. Presumably you are using a DataGridView, correct? The best way to achieve your aim depends on how you populated the grid in the first place. Is your grid bound to a data source, e.g. a DataTable, or did you insert the data directly.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    New Member
    Join Date
    Sep 2009
    Posts
    3

    Re: Highlight Datagrid row based on a column value

    i can acheive this with a datagridview control in VS2005 but the project I am working on is VS2003 and it has only a datagrid control and not datagridview control so my issue remains

    would appreciate any help possible

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Highlight Datagrid row based on a column value

    Quote Originally Posted by ibuksh View Post
    i can acheive this with a datagridview control in VS2005 but the project I am working on is VS2003 and it has only a datagrid control and not datagridview control so my issue remains

    would appreciate any help possible
    I see. This looks like the link you want:

    http://www.syncfusion.com/FAQ/window...44c.aspx#q745q

    Looks like the web site was changed from ASP (.asp) to ASP.NET (.aspx).
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7
    New Member
    Join Date
    Sep 2009
    Posts
    3

    Re: Highlight Datagrid row based on a column value

    Thanks for the help mate

    I also found another solution that is an easier approach

    Datagrid Row Color

    its built around similar logic though
    Last edited by ibuksh; Dec 6th, 2009 at 08:16 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width