Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 22nd, 2004, 03:26 PM
Authorized User
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default C# Conditional statements

For some reason my code isn't working. I have the follwing code:
        private void reporttype_SelectedIndexChanged(object sender, System.EventArgs e)
            string temp_reporttype = reporttype.SelectedValue;
            string temp_genassets = "General Assets";
            string temp_specassets = "Specific Assets";
            int temp_compare1 = string.Compare(temp_reporttype, temp_genassets);
            int temp_compare2 = string.Compare(temp_reporttype, temp_specassets);
                criteria_gen.Enabled = !(reportcriteria_gen.Enabled);
            Else If^(temp_compare2==0)^
                criteria_spec.Enabled = !(criteria_spec.Enabled);
                criteria_spec.Enabled = !(criteria_spec.Enabled(FALSE));
                criteria_spec.Enabled = !(criteria_spec.Enabled(FALSE));
and I get errors(I've placed ^ into the code at each spot) after both IF's and the last Else saying I need ;
I also get one after Else If(temp_compare2==0)

Old July 22nd, 2004, 03:35 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

C# is case sensitive. If should be if.....
You may also need a few additional brackets....

Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Watersnood by Hans Teeuwen (Track 2 from the album: Trui Cd 2) What's This?
Old July 23rd, 2004, 09:10 AM
Authorized User
Join Date: Aug 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts

Wow, Thanks a bunch Imar, that worked as soon as I changed I to i.

Similar Threads
Thread Thread Starter Forum Replies Last Post
regarding conditional statements abhi.prince4u XSLT 1 July 21st, 2007 06:00 AM
if statements brainchild Javascript 2 March 1st, 2007 06:08 AM
IF ELSE statements gmpurple Classic ASP Databases 4 November 15th, 2004 04:30 PM
Conditional Statements in web.config kbuckhei VS.NET 2002/2003 0 April 15th, 2004 04:12 PM
If, else if statements Joel JSP Basics 0 March 18th, 2004 06:17 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.