473,503 Members | 3,739 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what is wrong with this expression?



Hi all, I have the following event function, and the compiler is having a
problem handling negative constant values. What can be happening? Thanks in
advance..

private void button1_Click(object sender, System.EventArgs e)

{

double dME = 0.0;

if ( CB.SelectedItem.Equals("ME") )

{

//erro happens here.. compile says: Invalid expression term ''

dME = -0.1;

}

}
Nov 17 '05 #1
4 1262
Carlos <ch******@yahoo.com> wrote:
Hi all, I have the following event function, and the compiler is having a
problem handling negative constant values. What can be happening? Thanks in
advance..


Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2


--
Artur Borecki, MCP
"Carlos" <ch******@yahoo.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...


Hi all, I have the following event function, and the compiler is having a
problem handling negative constant values. What can be happening? Thanks
in advance..

private void button1_Click(object sender, System.EventArgs e)

{

double dME = 0.0;

if ( CB.SelectedItem.Equals("ME") )


wrong.
Method Equals(object)
"Determines whether the specified Object is equal to the current Object."
(from documentation)

you should write

if (CB.SelectedItem.ToString()=="ME")
{
}
--
Artur Borecki
Nov 17 '05 #3

"Artur Borecki" <ab******@tenbit.pl> wrote in message
news:uT**************@TK2MSFTNGP12.phx.gbl...
"Carlos" <ch******@yahoo.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...
{

double dME = 0.0;

if ( CB.SelectedItem.Equals("ME") )


wrong.

sorry. of course it's ok. my mistake.


Nov 17 '05 #4

"Carlos" <ch******@yahoo.com> wrote in message
news:uS**************@TK2MSFTNGP10.phx.gbl...


Hi all, I have the following event function, and the compiler is having a
problem handling negative constant values. What can be happening? Thanks in advance..

private void button1_Click(object sender, System.EventArgs e)

{

double dME = 0.0;

if ( CB.SelectedItem.Equals("ME") )

{

//erro happens here.. compile says: Invalid expression term ''

dME = -0.1;

}

}


I get no error when compiling your code. How many variables/objects named
"dME" do you have?
Nov 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

220
18803
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
7
1796
by: steve bull | last post by:
I have the following code snippet to read the colorRange attributes for the colorRangeSwatch in the xml file listed below. string expr = "/swatches/colorRangeSwatch/colorRange";...
6
407
by: Daniel Rudy | last post by:
What is wrong with this program? When I try to compile it, I get the following error. Compiler is gcc on FreeBSD. strata:/home/dcrudy/c 1055 $$$ ->cc -g -oe6-3 e6-3.c e6-3.c: In function...
12
1787
by: RoSsIaCrIiLoIA | last post by:
On Mon, 07 Feb 2005 21:28:30 GMT, Keith Thompson <kst-u@mib.org> wrote: >"Romeo Colacitti" <wwromeo@gmail.com> writes: >> Chris Torek wrote: >>> In article <4205BD5C.6DC8@mindspring.com> >>>...
3
2619
by: Peter | last post by:
Hello all, I have the following t-sql batch: create procedure stp_test ( @p_date1 as datetime = null, @p_date2 as datetime = null )
669
25390
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
5
10790
by: Ryan | last post by:
{"POINTID":77902,"MAPID":762,"LONG":-122.21654892,"LAT":"37.1834331019","CITY":"Boulder Creek","STATE":"CA","DIST":5745.4} I get an "invalid label" error... I'm kinda new to this. Thanks!
38
2474
by: DaVinci | last post by:
#include<stdio.h> #include<stdlib.h> #include<string.h> #define SECONDS_PER_YEAR (60*60*24*365)UL int main() { unsigned long int u_i = SECONDS_PER_YEAR; printf("%lu\n",u_i);
34
4422
by: Jorge | last post by:
Why is it listed here : http://www.crockford.com/javascript/recommend.html under "deprecation" ? Without it, how is an anonymous function() going to call itself (recursively) ? I use to...
24
3064
by: MU | last post by:
Hello I have some code that sets a dropdownlist control with a parameter from the querystring. However, when the querystring is empty, I get an error. Here is my code: Protected Sub...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
4991
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1492
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
369
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.