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. Image for the cookie policy date
close icon

CellCommentTips in VirtTreeGrid

Hi, I''ve taken the VirtTreeGrid sample, and added some validation of the cell value during GridSaveCellInfo. What I now want to do is display a cell comment tip if the validation fails. What I want to do is store the validation message in a hash during GridSaveCellInfo, then display it during GridQueryCellInfo . I''ve tried taking code from the CellCommentTip sample, and adding it to GridQueryCellInfo , but I seem to end up in a infinite loop. The code I added was something like: Dim style As New ExcelTipDLL.GridExcelTipStyleProperties(Me.Grid(e.RowIndex, e.ColIndex)) style.ExcelTipText = CStr(Me.CommentHash(me.GetHashCode(e.RowIndex, e.ColIndex))) The actaul code is too large to post. I will try to put together a simple sample, but in the meantime any help would be appreciated. Thanks Akash

3 Replies

AD Administrator Syncfusion Team September 16, 2005 03:48 PM UTC

Here is a sample illustrating the problem. I have code in SaveCellInfo that does validation on CellValue, and stores the error in a hashtable. Code in QueryCellInfo attempts to set the cell comment based on the hashtable value, but fails. Any ideas what I need to change? Thanks Akash VirtualTreeGrid+CellComments_246.zip


AD Administrator Syncfusion Team September 18, 2005 10:45 AM UTC

Hi Akash, Getting the style values using indexer causes recursive QueryCellInfo calls. You could change the code in QueryCellInfo handler as follows to get this working. Private Sub GridQueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs) If ((e.RowIndex > 0) _ AndAlso (e.ColIndex > 0)) Then e.Style.CellValue = externalData((e.RowIndex - 1)).Items((e.ColIndex - 1)) ''Add cellcommment Dim Key As String = Me.GetHashKey(e.RowIndex, e.ColIndex) If Me.CommentHash.ContainsKey(Key) Then ''MsgBox("oops") '' Getting the style value using indexer causes recursive loop '' instead get it using e.Style Dim style As New ExcelTip.GridExcelTipStyleProperties(e.Style) style.ExcelTipText = CStr(Me.CommentHash(Key)) End If Best regards, Jay N


AD Administrator Syncfusion Team September 19, 2005 10:20 AM UTC

Jay, Many thanks for the solution - didn''t expect an answer this early in the morning! Akash

Loader.
Live Chat Icon For mobile
Up arrow icon