Solved

Disable Row of Datagridview

Posted on 2011-03-17
3
324 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
Comment Utility
0
 

Author Comment

by:mgordon-spi
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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