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
Solved

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

Posted on 2013-05-13
8
992 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
  • 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 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