Long to int
-
- Posts: 31
- Joined: Thu May 30, 2019 1:01 pm
Long to int
Hi !! I´m trying to have a DataBand in a report that will set the number of columns depending on the number of rows.
I´m trying this on the before print event and getting an error about implicit conversion:
DataBand1.Columns = Count(DataBand1)
Then I tried this but it didn't work:
DataBand1.Columns = int.Parse(Count(DataBand1))
I also tried to create a variable as int and it didn't work as well:
ColSize = Count(DataBand1));
DataBand1.Columns = ColSize
How can I solve this problem ??
And would it be possible to set the width of the column the same as the width of a text component on something like this :
DataBand1.ColumnWidth = Text1.Width
Thanks in advanced !!
I´m trying this on the before print event and getting an error about implicit conversion:
DataBand1.Columns = Count(DataBand1)
Then I tried this but it didn't work:
DataBand1.Columns = int.Parse(Count(DataBand1))
I also tried to create a variable as int and it didn't work as well:
ColSize = Count(DataBand1));
DataBand1.Columns = ColSize
How can I solve this problem ??
And would it be possible to set the width of the column the same as the width of a text component on something like this :
DataBand1.ColumnWidth = Text1.Width
Thanks in advanced !!
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: Long to int
Hello,
Please try to use the following code in the BeforePrint event of the Page:
DataBand1.Columns = DataSource.Count;
Thank you.
Please try to use the following code in the BeforePrint event of the Page:
DataBand1.Columns = DataSource.Count;
Thank you.
-
- Posts: 31
- Joined: Thu May 30, 2019 1:01 pm
Re: Long to int
Lech Kulikowski, thank you so much !! It worked like a charm !!Lech Kulikowski wrote: ↑Sun Jun 02, 2019 7:53 pm Hello,
Please try to use the following code in the BeforePrint event of the Page:
DataBand1.Columns = DataSource.Count;
Thank you.
Now I have the second part of my question:
DataBand1.ColumnWidth = Text1.Width
The problem is: the object Text1 is set as AutoWidth and when I try to get the width of the object I only get what's set in the report, I would like to get the value that it is given when I run the report so I can set the column width to that value.
Would it be possible ??
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: Long to int
Hello,
You can try to use DoublePass, in the first check and save widths and in the second set it.
Thank you.
You can try to use DoublePass, in the first check and save widths and in the second set it.
Thank you.
Re: Long to int
Or just call method GetActualSize() of the text element (returns SizeD). Ensure that correct text has been set before (this method does not trigger any event of the text box!).
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: Long to int
Hello,
Thank you for the additional solution.
Thank you for the additional solution.
-
- Posts: 31
- Joined: Thu May 30, 2019 1:01 pm
Re: Long to int
MatthiasU and Lech Kulikowski, thanks for the solutions !! Got it to work.
-
- Posts: 6266
- Joined: Tue Mar 20, 2018 5:34 am
Re: Long to int
Hello
We are always glad to help you!
Thank you.
We are always glad to help you!
Thank you.