How to conditionally hide a TextBox on a Report, shifting the rest of the contents up?

Hello,

I have basic, local reporting working very well in my Windows Forms application via ReportParameters.

On my report, I have a TextBox, the value of which is bound to a parameter.

It is possible that this value can be empty (or null, if you wish). If this is the case, then I do not want the TextBox to appear at all. Specifically, I want it to shrink and I'd like all of the other controls (also TextBoxes) beneath it to shift "up". It's basically a Shrink operation, but I can't figure out how to get a TextBox to shrink completely, depending on its value, at runtime...


Thanks for any help,

--Mike


Answer this question

How to conditionally hide a TextBox on a Report, shifting the rest of the contents up?

  • Clinton Cherry

    You can control the Visiblity property of the textbox using an expression. In the property panel for the textbox, expand Visibility, then set the value of Hidden to an expression like this: =iif(user!UserID.Contains("Mike"), true, false)
  • Fran-1980

    And pointers on this from MS I'm still struggling with this issue, and it's a pretty important to have in my particular scenario.

    One thing I've tried is to make the TextBox height 0 inches, with the hope of getting them to "grow" automatically with the presence of any text. I would then need to do something similar for the spacing, putting in an empty string (or null value ) to get it to expand if necessary.

    I feel though that this is kind of hacky/kludgy, and was hoping for direction on a more appropriate way to do this.


    Thank you,

    --Mike

  • Justin Tang

    Mike,

    Can you elaborate on your "with a few tweaks"

    TIA


  • JacobEgholm

    Rajeev,

    Thanks so much for your response. I did exactly as you suggest, and with a few tweaks I have the report output pretty much perfect. I know you're busy--thanks for the response, and thanks to you and Brian for all of your help over the past few days.

    It's really great to have an effective reporting solution built in! I never was a fan of the alternatives.

    Good job, guys!

    --Mike

  • How to conditionally hide a TextBox on a Report, shifting the rest of the contents up?