473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to convert type 'int' to 'bool'

hai everyone
Expand|Select|Wrap|Line Numbers
  1.  
  2. private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
  3.         { 
  4.  
  5.  
  6.             if(DropDownList1.SelectedIndex=0)
  7.             {
  8.                 Panel2.Visible=true;
  9.                 }
  10.         else
  11.                 DropDownList1.SelectedIndex=1;
  12.                 {
  13.                     Panel3.Visible=true;
  14.                     }
  15.         }
  16.  
  17.  
in this c# programm i have an error Cannot implicitly convert type 'int' to 'bool' how to solve this problem

thankyou
Sep 1 '06 #1
1 8056
luresh
2
Hi

change if(DropDownList1.SelectedIndex=0) into if(DropDownList1.SelectedIndex==0)
{
}


ie u should use == operator not = (assignment operator)

bye
Sep 1 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: GRoll21 | last post by:
I have a program here that asks the number of students surveyed. then it will ask how many movies each student has watched. After thats been collected it does functions to find the average, median,...
3
by: MJB | last post by:
I'm getting an IStream back from function xmlHttp.responsestream. I would like to convert this to a System.IO.Stream in order to work with it in my application. Has anyone encountered this and...
24
by: djozy | last post by:
Please, how can I convert selected item from dropdown list to integer? Thank you
14
by: Chris | last post by:
Hi, I try to print out truth-tables for an &&-operation using the following code, unfortunatly I get compiler errors : for ( byte i1=0; i1<=1; i1++) { for ( byte i2=0; i2<=1; i2++) { bool...
2
by: Patrick Olurotimi Ige | last post by:
When i convert:- this code from VB to C# Why do i get error "Cannot implicitly convert type 'object' to 'bool' VB --- If cmdcommand.Parameters("ReturnValue").Value = 1 Then lblStatus.Text =...
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
2
by: Nick | last post by:
I am trying to find out if particular array element contains InputOutput value. private static int FillParameters(DbCommand command, SqlParameter p) { int x = 0; //int initalize to hold zero...
6
by: John | last post by:
The following code: int test = 1; bool isTrue = (bool)test; results in a compiler error: Cannot convert type 'int' to 'bool' wtf, any ideas on how to work around this?
8
by: puzzlecracker | last post by:
Is it possible, in a clean way, to convert int values too bool int i=10; bool b=(bool)i; instead of doing b=(i>0);
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.