Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 Programatically Show Hide Textboxes

Author  Topic 

miriv365
Starting Member

3 Posts

Posted - 2005-04-18 : 11:20:59
I have a crystal report that I am having to convert over to SQL reporting services. In the Crystal report, I am able to programatically show/hide texboxes, however, I am running into a problem doing the same thing in SQL Reporting services. I have two textboxes side by side. One textbox is just a description of what is going to be showing in the next textbox along the lines of this

1st Textbox 2nd Textbox
Formula a2+b2=c2

I would like the text in the first box to have visibility of False when there is no value in the second textbox. I am using the following code but get the following error.


Public Function ShowBox() as Boolean
Dim ReturnValue as Boolean
If (Len(Fields!itm_Formula.Value)>0) Then
ReturnValue=True
Else
ReturnValue=False
End If
Return ReturnValue
End Function

In the Visibility expression section of Textbox1 I am referenceing that code with the following line:

=Code.ShowBox()

I am getting the following error when trying to run the report

[BC30469] Reference to a non-shared member requires an object reference.

Can anyone help with this?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-18 : 12:47:23
I don't think that you can reference a field inside the VB code: Fields!itm_Formula.Value)>0

You would have to pass that value into this function in order to be able to use it. But I'm wondering why you are even bothering with this, when you can do this in the expression of that textbox in the hidden property of the visibility attribute.

Tara
Go to Top of Page

miriv365
Starting Member

3 Posts

Posted - 2005-04-18 : 13:06:49
I am very new to SQL Reporting Services (5 days to be exact)-- How exactly would I do what you mentioned in your reply?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-18 : 13:11:21
Highlight the text box that you want to be hidden sometimes, go to the visibility/hidden property. Use an expression:

IIf((Len(Fields!itm_Formula.Value)>0), False, True)


Tara
Go to Top of Page

miriv365
Starting Member

3 Posts

Posted - 2005-04-18 : 14:22:22
Thanks, that worked great!
Go to Top of Page
   

- Advertisement -