Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Disable Row of Datagridview

Posted on 2011-03-17
3
327 Views
Last Modified: 2012-05-11
I am filling a datagridview and I want to be able to disable certain rows where a boolean is true.

Thanks in advance
Private Sub dgFeedback_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles dgFeedback.CellFormatting
        Dim drvFeedback As DataRowView
        If e.RowIndex >= 0 Then
            drvFeedback = dtFeedback.DefaultView.Item(e.RowIndex)
            If drvFeedback.Item("bAck") = True Then

            End If
        End If
    End Sub

Open in new window

0
Comment
Question by:mgordon-spi
  • 2
3 Comments
 
LVL 6

Expert Comment

by:nandithaa
ID: 35162998
0
 

Author Comment

by:mgordon-spi
ID: 35169736
I have already looked at that link, I can't see how to disable particular rows with that. If you can I would appreciate it.
0
 
LVL 6

Accepted Solution

by:
nandithaa earned 500 total points
ID: 35170687
I don't know your table structure. So check if this helps or not....

Private Sub dgFeedback_CellFormatting(sender As Object, e As System.Windows.Forms.DataGridViewCellFormattingEventArgs)
	Dim drvFeedback As DataRowView = Nothing
	If e.RowIndex >= 0 Then
		drvFeedback = dtFeedback.DefaultView.Item(e.RowIndex)

		If drvFeedback("bAck") = True Then
			For Each drgv As DataGridViewRow In dgFeedback.Rows
				If drvFeedback("Id").ToString() = drgv.Cells("Id").Value.ToString() Then
					drgv.[ReadOnly] = True
				End If
			Next
		End If
	End If
End Sub

Open in new window

0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 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