By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,212 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,212 IT Pros & Developers. It's quick & easy.

int.ToString() does not exist. Why?

P: n/a
For whatever reason, I keep getting error of int.ToString() not
existing. Why not?
Has anyone encountered this problem before?

May 12 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hello ax****@gmail.com,

Any code sample?
For whatever reason, I keep getting error of int.ToString() not
existing. Why not?
Has anyone encountered this problem before?


---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 12 '06 #2

P: n/a
ToString() is a non-static method, and so you need an object reference (an
instance), you can't call the method on the type itself.
So "int.ToString()" won't work, while

int i = 10;
i.ToString(); will work.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ax****@gmail.com" wrote:
For whatever reason, I keep getting error of int.ToString() not
existing. Why not?
Has anyone encountered this problem before?

May 12 '06 #3

P: n/a
Sorry. The title of the post could be miesleading, but that's what I
did exactly.

int nStartRow = (currentPage * dgTest.PageSize) + 1;
int nEndRow = nStartRow + dgTest.PageSize - 1;

Both nStartRow and nEndRow spit out value correctly as int data type,
but as soon as adding .ToString() method to each, I get the error
saying "nStartRow.ToString() does not exist". or "nStartRow.ToString()
does not exist".
When I view in "Watch" panel in VS.Net.

On error message on the brpwser tells me :
"Exception Details: Exception of type System.Web.HttpUnhandledException
was thrown.

Exception Details: Exception of type System.Web.HttpUnhandledException
was thrown.
Object reference not set to an instance of an object."

May 12 '06 #4

P: n/a
ax****@gmail.com wrote:
int nStartRow = (currentPage * dgTest.PageSize) + 1;
int nEndRow = nStartRow + dgTest.PageSize - 1;

Both nStartRow and nEndRow spit out value correctly as int data type,
but as soon as adding .ToString() method to each, I get the error
saying "nStartRow.ToString() does not exist". or "nStartRow.ToString()
does not exist".


Show us some more code. Where are you adding the ToString()? We need
more information to help you.

May 12 '06 #5

P: n/a
Try:

Int32 i = 12345 ;
string x = Convert.ToString(i) ;

May 12 '06 #6

P: n/a
My bad, guys. Although it showed "nStartRow.ToString() does not exist"
in Watch window, the problem was somewhere else.

May 12 '06 #7

P: n/a
It isn't static, you will need an instance

int myInt = 0;
Console.Write(myInt.ToString());

<ax****@gmail.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
For whatever reason, I keep getting error of int.ToString() not
existing. Why not?
Has anyone encountered this problem before?

May 15 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.