2 Replies - 917 Views - Last Post: 07 August 2012 - 11:46 PM Rate Topic: -----

#1 xxrhy  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 51
  • Joined: 08-April 12

Search and Highlights found item in datagrid?

Posted 07 August 2012 - 01:51 AM


Public Class search_room

    Private Sub btn_back_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_back.Click
        Me.Hide()
        FacStu.Opacity = 1
    End Sub

    Private Sub btn_delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_delete.Click
        searchDGV(tbx_finder.Text)
        FacStu.Opacity = 1
        Me.Hide()


    End Sub

    Sub searchDGV(ByVal selSearch As String)
        With FacStu.DataGridView1
            Dim iTemp As Integer = 1
            If Login.DataGridView1.AllowUserToAddRows Then iTemp = 2 '// check if extra row or not, at bottom of dgv.
            For i As Integer = 0 To .Rows.Count - iTemp '// loop thru all rows.
                For x As Integer = 0 To .Columns.Count - 1 '// loop thru all columns in a row.
                    If Login.DataGridView1.Item(x, i).Value = selSearch Then '// locate your search.
                        Login.DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Lime
                    End If
                Next
            Next
        End With
    End Sub
End Class




that my code? when i run nothings happen?

Is This A Good Question/Topic? 0
  • +

Replies To: Search and Highlights found item in datagrid?

#2 m_wylie85  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 93
  • View blog
  • Posts: 871
  • Joined: 15-October 10

Re: Search and Highlights found item in datagrid?

Posted 07 August 2012 - 06:35 AM

something must happen. Use breakpoints in the code and walk through it, and see what is happening also try using a try catch block to see if you are get errors then give use the error and tell us where the code fails
Was This Post Helpful? 0
  • +
  • -

#3 xxrhy  Icon User is offline

  • D.I.C Head

Reputation: -1
  • View blog
  • Posts: 51
  • Joined: 08-April 12

Re: Search and Highlights found item in datagrid?

Posted 07 August 2012 - 11:46 PM

i doesn't have any error but i cant see the result. when i click the button it stay as what i see
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1