Flexgrid Row Selection out of Control

Posted by: saidnai on 18 January 2019, 4:01 am EST

    • Post Options:
    • Link

    Posted 18 January 2019, 4:01 am EST

    Hi all,

    I have an issue with Flexgrid as follow: After the selection of the row, i cannot see the values anymore and the selection of the row is out of control. If i click on the next row, the one before stay selected.

    The target is to be able to select only one row.

    The selected row must be highlited and the values are shown.

    Select another row means deselect the previous one.

    Can you please Support how to get this running?

    I have joind a sample app for this.

    Best regards

    Said Nai

    CMixer.zip

  • Posted 20 January 2019, 9:19 pm EST

    Hello,

    i cannot see the values anymore

    I am unable to reproduce the issue at my end with the latest build. Could you please check with the latest build at your end. You can download the same from the following link:

    http://prerelease.componentone.com/dotnet40/c1winforms/2018-t3/C1WinForms.4_4.0.20183.343.zip

    If i click on the next row, the one before stay selected.

    I have modified the code in MouseDown event to achieve the desired result:

    
    Private Sub DGB_MouseDown(sender As Object, e As MouseEventArgs) Handles DGB.MouseDown
            Try
                Dim myGrid As C1FlexGrid = CType(sender, C1FlexGrid)
                Dim hti As HitTestInfo
                hti = myGrid.HitTest(e.X, e.Y)
                Select Case hti.Type
                    Case HitTestTypeEnum.Cell
                        If DGB(hti.Row, 1) > 0 Then
                            DGB.Rows(ClickRow).Selected = False
                            ClickRow = hti.Row
                            ClickP = DGB.Item(ClickRow, 1)
                            DGB.Rows(ClickRow).Selected = True
                        End If
                    Case HitTestTypeEnum.RowHeader
                        If DGB(hti.Row, 1) > 0 Then
                            DGB.Rows(ClickRow).Selected = False
                            ClickRow = hti.Row
                            ClickP = DGB.Item(ClickRow, 1)
                            DGB.Rows(ClickRow).Selected = True
                        End If
                        'Case HitTestTypeEnum.ColumnHeader 'C1.Win.C1FlexGrid.HitTestType.RowHeader
                End Select
    
            Catch ex As Exception
                MsgBox("Error 'DGB_MouseDown' : " & vbCrLf & ex.ToString, MsgBoxStyle.Critical)
            End Try
        End Sub
    
    

    Also, please refer to the attached video and modified sample.

    Note: I have done some changes in the code due to the different database

    Thanks.

    vid_Selection.zip

    CMixer_Modifed.zip

  • Posted 20 January 2019, 10:44 pm EST - Updated 3 October 2022, 4:37 pm EST

    Dear Mohitg,

    Thanks for the quik answer. I saw the Video and also have done the changes you mentioned. The selection is working fine. But when the row is higlithed i cann’t see the values anymore. This meams the flexgrid drawing has to be adjust Event oncklik or other event. Can you please instruct how to chage the Colors when selecting one row?

    Picture attached.

    Best regards

    Said Nai

  • Posted 21 January 2019, 12:00 am EST

    Hello,

    Could you please share the sample database so that I will help you with according to your database.

    Thanks.

  • Posted 21 January 2019, 8:44 pm EST

    Dear Mohitg,

    1. First Issue: Visual Basic

      I have attached a sample Access DB for you. Please be informed. The main problem is the layout of the Flexgrid. When a row is highlighted the value cann’t be shown. I have tried to do some Forecolor in the properties of the Flexgrid Styles no Chance.

    2. Second Issue: Visual Basic

      I please also need your help regarding the Flexgrid. How to detect a real value change in a cell from the user.

      Sample of update: Flexgrid(r,c) = 1 old value // Flexgrid(r,c) = 2 value changed, hire

      msgbox “Yes” when leaving the cell.

                                 Flexgrid(r,c) = 1 old value  //   Flexgrid(r,c) = 1 no value change , hire 			                          msgbox "No" when leaving the cell.
      

    Thanks for your Support.

    Best regards

    Said Nai

  • Posted 22 January 2019, 12:23 am EST

    Hello,

    It seems that files are not attached properly. Could you please attached in Zip format.

    Thanks

  • Posted 22 January 2019, 12:34 am EST

    Dear Mohitg,

    Please.

    Best regatds

    Said

  • Posted 22 January 2019, 12:35 am EST

    Dear Mohitg,

    Please.

    Best regatds

    Said

  • Posted 22 January 2019, 12:35 am EST

    again.

  • Posted 22 January 2019, 12:37 am EST

    It seems the rar is not accepted.

    C1Trial.zip.

    Best regards

    Said

  • Posted 22 January 2019, 8:57 pm EST

    Hello Said,

    When a row is highlighted the value cann’t be shown

    To overcome this problem, please use the following line of code in “OwnerDrawCell” event

    
    DGB.Cols(2).Style.Display = DisplayEnum.ImageOnly
    
    

    instead of

    
      e.Style.Display = C1.Win.C1FlexGrid.DisplayEnum.ImageOnly
    
    

    How to detect a real value change in a cell from the user.

    Please use the “StartEdit” and “AfterEdit” event to detect a real value change in a cell. please refer to the following lines of code:

    
     Private Sub DGB_AfterEdit(sender As Object, e As RowColEventArgs)
            If Temp = DGB(e.Row, e.Col) Then
                MessageBox.Show("No Value Change")
            Else
                MessageBox.Show("Value Changed")
            End If
        End Sub
    
        Dim Temp
        Private Sub DGB_StartEdit(sender As Object, e As RowColEventArgs)
            Temp = DGB(e.Row, e.Col)
        End Sub
    
    

    Also, please refer to the modified sample.

    Thanks.

    CMixer_Modified2.zip

  • Posted 26 January 2019, 9:19 pm EST

    Dear Mohitg,

    Perfect as i wich.

    Thanks a lot.

    Best regatds

    Said

  • Posted 26 January 2019, 9:19 pm EST

    Dear Mohitg,

    Perfect as i wich.

    Thanks a lot.

    Best regads

    Said

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels