Solved

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

Posted on 2013-05-13
8
963 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 74

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 74

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
 

Author Comment

by:newjeep19
ID: 39162530
The value retruned is the Guid of a person found via a Lookup
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 74

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 74

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to read XML file attributes... 17 42
Using MS Code on my Mac 6 47
Image(2) 3 28
Iterate a dictionnary to change values 4 30
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now