Error in QueryBuilderForm

There is namespace MW5.Attributes.Forms (public partial class QueryBuilderForm : MapWindowForm) with this statment:

if (tbl.Query(richTextBox1.Text, ref result, ref err))

VS 2019 reports an error: Argument 2 must be passed with the ‘out’ keyword!

After replacing ref with out:

if (tbl.Query(richTextBox1.Text, out result, out err))

VS error is: Argument 2: cannot convert from ‘out object’ to ‘out int[]’

Could one show me how to handle this problem.

Thanks for the help, Vojko

Hi Vojko,

not 100% sure how you defined your variables “result” and “err” but it seems that one of them has to be an integer array, looking at the error phrase. My guess is “result” has to be the array, but might be wrong.
It is maybe a good idea to read up on arrays and how you define single or multi column arrays if you did not yet.

Here some idea, i only do not know what size array is expected:

private int [,] result = new int[1,10] //Can be defined in main program.

if (tbl.Query(richTextBox1.Text, out result, out err))

Kind regards,

Remco

Hello @vzav , @Rem97

Although I don’t normally code in c#, I looked through the source code to MapWindow5 (which is written in c#), and I found this code:

        string err;
        int[] arr;

        if (_table.Query(expression, out arr, out err))
        {
            ...
        }

Hope that helps.
Jerry.

Hi there!
Thank You both for help. Build is now flawless. You will need to apply the correction into the original MW5 source code.
Regards, Vojko

Hello @vzav

I’m glad it’s working now. I’m not sure, however, what is the correction you are saying needs to be made to the MW5 code? Could you post what you did to make it work? Is it something specific to VS2019?

Thank you,
Jerry.

Hi Jerry!

VS2019 reports error only in MW5-5.1 code, latest MW5-5.5 is OK!
Thank you,
Vojko

Thank you for the clarification.

Kind Regards,
Jerry.