Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disable Row of Datagridview

Posted on 2011-03-17
3
Medium Priority
?
343 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…

971 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