We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to loop through all cell of a DataGrid in VB.net

Thread ID:

Created:

Platform:

Replies:

428 Jun 25,2002 02:30 PM UTC Windows Forms 0
loading
Tags: FAQ
Peter
Asked On June 25, 2002 02:30 PM UTC

I found some code I liked very much in ASP.net. I'm trying to modify it so it works with VB.NET. No luck so far. There is no Items property of the grid. Please help. Any other idea will help. Thank you! Private Sub SetHierarchical(ByVal bExpanded As Boolean) Dim iCount As Int32 For iCount = 0 To dgValues.Items.Count - 1 'set the bg colour of the Customer and Order rows and the plus minus cells If dgValues.Items(iCount).Cells(1).Text <> " " Then dgValues.Items(iCount).BackColor = System.Drawing.Color.Wheat dgValues.Items(iCount).Cells(0).BackColor = System.Drawing.Color.Tan End If If dgValues.Items(iCount).Cells(3).Text <> " " Then dgValues.Items(iCount).BackColor = System.Drawing.Color.AntiqueWhite dgValues.Items(iCount).Cells(2).BackColor = System.Drawing.Color.Tan End If 'set the bg colour of the total rows If dgValues.Items(iCount).Cells(4).Text = "Customer Total" Then _ dgValues.Items(iCount).BackColor = System.Drawing.Color.AntiqueWhite If bExpanded Then 'hide + on Test all rows where there is not an expandable node If dgValues.Items(iCount).Cells(3).Text = " " Then dgValues.Items(iCount).Cells(2).Controls(0).Visible = False Else 'set the minus sign CType(dgValues.Items(iCount).Cells(2).Controls(0), LinkButton).Text = "-" CType(dgValues.Items(iCount).Cells(2).Controls(0), LinkButton).CssClass = "PlusMinus" End If 'hide + on all Collection rows where there is not an expandable node If dgValues.Items(iCount).Cells(1).Text = " " Then dgValues.Items(iCount).Cells(0).Controls(0).Visible = False Else 'set the minus sign CType(dgValues.Items(iCount).Cells(0).Controls(0), LinkButton).Text = "-" End If Else 'hide + on all Order rows where there is not an expandable node If dgValues.Items(iCount).Cells(3).Text = " " Then dgValues.Items(iCount).Cells(2).Controls(0).Visible = False Else 'set the plus sign CType(dgValues.Items(iCount).Cells(2).Controls(0), LinkButton).Text = "+" CType(dgValues.Items(iCount).Cells(2).Controls(0), LinkButton).CssClass = "PlusMinus" End If 'hide + on all Customer rows where there is not an expandable node If dgValues.Items(iCount).Cells(1).Text = " " Then dgValues.Items(iCount).Cells(0).Controls(0).Visible = False Else 'set the plus sign CType(dgValues.Items(iCount).Cells(0).Controls(0), LinkButton).Text = "+" CType(dgValues.Items(iCount).Cells(0).Controls(0), LinkButton).CssClass = "PlusMinus" End If 'hide all child nodes and rows of the root nodes If dgValues.Items(iCount).Cells(1).Text = " " Then dgValues.Items(iCount).Visible = < FONT color = #0000ff > False End If Next End Sub

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;