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

validating control value in grid cell

Thread ID:

Created:

Updated:

Platform:

Replies:

44228 May 17,2006 04:19 PM UTC May 18,2006 11:04 PM UTC Windows Forms 2
loading
Tags: GridControl
Jenny Wilson
Asked On May 17, 2006 04:19 PM UTC

I''m adding custom controls to grid cells and the grid seems to be eating the events that normally would fire for the control, including the control''s validating event -- this is the event I would prefer to use for validation. Since this was not working I attempted to use the CurrentCelllValidating event, but this does not fire for this cell. How do I validate the grid cell? If possible, I''d prefer to use the control''s validating event. Here''s what I''m doing: Dim newCustomControl As New CustomControl Me.Controls.Add(newCustomControl) AddHandler newCustomControl.Validating, AddressOf newCustomControl_Validating With grdOptions.Item(rowIndex, colIndex) .CellType = "Control" .Control = newCustomControl .CellValueType = GetType(String) End With Thanks.

Administrator [Syncfusion]
Replied On May 18, 2006 04:32 AM UTC

Hi Jenny, Typically this types of error occurs if you are not properly handle CurrentCell.IsModified flag. Without setting the CurrentCell.IsModified = true, your saveCellInfo is not called when you leave the cell the control which means your changes were not being saved in the grid. SaveCellInfo event fires the CurrentCellValidating Event. Please try this code in CurrentcellMoving Event Private Sub gridControl1_CurrentCellValidating(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles gridControl1.CurrentCellValidating Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell Dim user As UserControl1 = CType(IIf(TypeOf cc.Renderer.Control Is UserControl1, cc.Renderer.Control, Nothing), UserControl1) If Not user Is Nothing Then MessageBox.Show(user.Uservalue,"Selected Language") End If End Sub Private Sub gridControl1_CurrentCellMoving(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCurrentCellMovingEventArgs) Handles gridControl1.CurrentCellMoving Dim cc As GridCurrentCell = Me.gridControl1.CurrentCell If cc.MoveFromRowIndex = 1 AndAlso cc.MoveFromColIndex = 1 Then Dim user As UserControl1 = CType(IIf(TypeOf cc.Renderer.Control Is UserControl1, cc.Renderer.Control, Nothing), UserControl1) If Not user Is Nothing Then cc.IsModified = True End If End If End Sub Here is a sample. http://www.syncfusion.com/Support/user/uploads/VBControlValidating_49578baf.zip Let me know if you have any more questions. Regards, Haneef

Jenny Wilson
Replied On May 18, 2006 11:04 PM UTC

Setting the IsModified property in CurrentCellMoving was just what I needed. Thanks!

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

;