int.ToString() does not exist. Why?

  • Thread starter Thread starter axkixx
  • Start date Start date
A

axkixx

For whatever reason, I keep getting error of int.ToString() not
existing. Why not?
Has anyone encountered this problem before?
 
Hello (e-mail address removed),

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
 
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
 
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."
 
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.
 
My bad, guys. Although it showed "nStartRow.ToString() does not exist"
in Watch window, the problem was somewhere else.
 
It isn't static, you will need an instance

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