Solved

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

Posted on 2013-05-13
8
980 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Coding C# in Linux 8 61
designing in object programming 12 75
SSRS Dynamic Column Names - Last 8 Weeks 3 36
Example works but why do I need to click twice on button 4 36
Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

786 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