How to set the ConditionView in VB.NET

Dec 10, 2014 at 5:41 AM
Hello.

I am using the DataGrid in VB.net.

I am almost no C # experience, but from C # code by using, for example, conversion services to VB code sample code to reference.

However, we are absolutely sure about not trouble either of the following code of frmSample41.cs the (★) can write how in VB.

//Create selected conditions
        SourceGrid.Conditions.ConditionView selectedConditionBold = new SourceGrid.Conditions.ConditionView(viewSelected);
        ★selectedConditionBold.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
                                                {
                                                    DataRowView row = (DataRowView)itemRow;

return row["Selected"] is bool && (bool)row["Selected"] == true;

Me Would you please tell me how to write in VB anyone?

Thank you
Excuse my English.
Jan 20, 2015 at 7:26 PM
Hi takeo,

For this line:
selectedConditionBold.EvaluateFunction = delegate(SourceGrid.DataGridColumn column, int gridRow, object itemRow)
                                        {
                                            DataRowView row = (DataRowView)itemRow;
                                            return row["Selected"] is bool && (bool)row["Selected"] == true;
                                        };
You can convert to VB by using AddressOf, then you create a private function in the same module level as follwing
    'Create selected conditions
    Dim selectedConditionBold As New SourceGrid.Conditions.ConditionView(viewSelected)
 ★   selectedConditionBold.EvaluateFunction = AddressOf SelectedCondition_EvaluateFunction

    Dim selectedConditionStar As New SourceGrid.Conditions.ConditionCell(New SourceGrid.Cells.Virtual.CellVirtual())
    selectedConditionStar.Cell.Model.AddModel(New SourceGrid.Cells.Models.Image(My.Resources.Star.ToBitmap()))
★    selectedConditionStar.EvaluateFunction = AddressOf SelectedCondition_EvaluateFunction
........
End Sub

Private Function SelectedCondition_EvaluateFunction(ByVal column As SourceGrid.DataGridColumn, ByVal gridRow As Integer, ByVal itemRow As Object) As Boolean
    Dim row As DataRowView = itemRow
    SelectedCondition_EvaluateFunction = False
    If row("Selected").GetType().Equals(GetType(Boolean)) Then
        If row("Selected").Equals(True) Then
            SelectedCondition_EvaluateFunction = True
        End If
    End If
End Function
Jan 22, 2015 at 4:24 AM
Hello, Matthew_Yee.

Your answer is perfect for me.
I wanted to change the format by the value entered in the text box.
I was able to achieve with your help.
Thank you all!

Takeo