Solved

Disable Row of Datagridview

Posted on 2011-03-17
3
328 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
[X]
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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

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