Solved

Getting this error: Cannot implicitly convert type 'bool' to 'System.Guid'

Posted on 2013-05-13
8
997 Views
Last Modified: 2013-05-14
I am trying to hide or show data on an SSRS report when a checkbox on a .NET application is checked. I am using c#.

My code is below:
 if (chkShowServiceSupportRep.Checked == true)
            {
                if (gtri_maintenanceid != Guid.Empty)
                {
                    servicesupportrep.Value = true; // causes error
                }
                else
                {
                    if (gtri_maintenanceid == Guid.Empty)
                    {
                        servicesupportrep.Value = false; // causers error
                    }
                }
            }

Open in new window


gtri_maintenanceid = Guid
servicesupportrep = Lookup

Please help
0
Comment
Question by:newjeep19
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39162476
Is the above correct:  servicesupportrep is of type Lookup? Is it nullable?
0
 

Author Comment

by:newjeep19
ID: 39162481
Correct.....
private Lookup servicesupportrep = new Lookup();
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39162500
Is Lookup a class you created? What is the type of the object returned by the Value property?
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

Author Comment

by:newjeep19
ID: 39162530
The value retruned is the Guid of a person found via a Lookup
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39162537
OK, so look at what you just said:

The value retruned is the Guid...

, and look at what you are trying to do in code:

servicesupportrep.Value = true;

How can you assign a boolean (e.g. true) to something that is of type Guid?
0
 

Author Comment

by:newjeep19
ID: 39162549
Thats what I am trying to figure out. I have a checkbox. If the checkbox is checked then I want the value of the Lookup (Guid) to be shpwn on a Report. So, the checkbox either hides or shows the lookup value.
0
 

Author Comment

by:newjeep19
ID: 39162776
I also tried this:
if (chkShowServiceSupportRep.Checked == true)
            {
                if (gtri_maintenanceid != null)
                {
                    servicesupportrep.Value = gtri_maintenanceid;
                }
                else
                {
                    if (gtri_maintenanceid == null)
                    {
                        servicesupportrep.Value = Guid.Empty;
                    }
                }
            }

Open in new window

0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39162796
IIRC, there should be a Visibility property on the control you are using to display the Lookup. You can set that expression to be the value of the chkShowServiceSupportRep check box's checked state. Have you tried putting anything in the Visibility field?

What kind of control are you using for the chkShowServiceSupportRep field?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

How to use Variables  and Custom code in SSRS report and Assembly reference to use compile shared code in SSRS. Its big question for all who are working with SSRS. It is easy to create assembly and refer in SSRS report, still there are some steps…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question