|
|
 |
Re: FN-FORUM: C# Help
date posted 8th February 2008 16:14
Phillip Healey wrote:
> Hi,
>
> Im tinkering with a tutorial / sample code which was given in VB.Net, and i have converted into c#. However i keep getting an error with this code:
>
> if ((int.Parse(intCurrIndex.Text) + (1 < int.Parse(intRecordCount.Text))))
> {
> intCurrIndex.Text = ((int.Parse(intCurrIndex.Text) + int.Parse(intPageSize.Text))).ToString();
> }
>
> The error says: Operator '+' cannot be applied to operands of type 'short' and 'bool'
>
> Can anyone help me format / rectify this.
>
The result of the first parenthesis is a number (you converted the text
to an int) and then you are trying to add it to the contents of the
second parenthesis which is a bool (is 1 less than the result of turning
the text into a number) so that is never going to work. if you want to
do addition then both sides of the + operator have to be of a number
type. What is it that you are actually trying to do?
--
Cheers,
Gary
http://www.garyshort.org
|
 |
|