Skip to Content

How to properly select/clear all rows in a grid

Hi,

I have a custom screen that shows items and their prices. The first column is a checkbox. I have a "Select All" button and a "Clear All" button. The following code does the select all function:

objForm.Freeze(True)

For i = 0 To objGrid.DataTable.Rows.Count - 1

If objGrid.DataTable.GetValue(3, i) = 0 Then

objCheck.Check(i, False)

Else

objCheck.Check(i, True)

End If

Next

objForm.Freeze(False)

objForm.Update()

I have about 1000 items loaded in the grid. It takes over a minute to select all and clear all. I have to add code for progres bar just to show that it's not hung. Yet in standard B1 UI, there are screens that you can clear all rows (like the Hierarchy screen, clear button) almost instantly. Am I doing something wrong? Is there a more efficient way to select/unselect all rows?

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 01, 2007 at 05:49 PM

    The best form that you select or clear all you rows is using the Datasources or UserDatasource, for example:

    Mo_Forma.DataSources.UserDataSources.Item("itemid").Value = ValOff or ValOn
    

    it depends of your want select or unselect.

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 01, 2007 at 08:07 PM

    Well, If you have installed the SDK of SAP B1, you can check the folder Samples, path is some like this D:\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources\2003, this example can help you.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 01, 2007 at 08:27 PM

    When you built your form for your grid you need specify the type of your column in this case depend of your version of SAP B1, for example from B1 2004 or early you need to use

    SAPbouiCOM.BoFormItemTypes.it_EDIT

    and from B1 2005 to later

    SAPbouiCOM.BoGridColumnType.gct_EditText

    . And in your datasource as the object checkbox use two properties called ValOn or ValOff and how they receives a string, the type for your datasource for this columns would be

    SAPbouiCOM.BoDataType.dt_SHORT_TEXT

    , for example

    Mo_Forma.DataSources.UserDataSources.Item(chkEliminaCURP).Value = "Y"

    in this case value "Y" is for checked option.

    I hope that this help you!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.