474,052 Members | 26,962 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

int.ToString() does not exist. Why?

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

May 12 '06 #1
7 3955
Hello ax****@gmail.co m,

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
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.c om" 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
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.ToSt ring() does not exist". or "nStartRow.ToSt ring()
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.Http UnhandledExcept ion
was thrown.

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

May 12 '06 #4
ax****@gmail.co m 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.ToSt ring() does not exist". or "nStartRow.ToSt ring()
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
Try:

Int32 i = 12345 ;
string x = Convert.ToStrin g(i) ;

May 12 '06 #6
My bad, guys. Although it showed "nStartRow.ToSt ring() does not exist"
in Watch window, the problem was somewhere else.

May 12 '06 #7
It isn't static, you will need an instance

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

<ax****@gmail.c om> wrote in message
news:11******** *************@u 72g2000cwu.goog legroups.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1764
by: qazmlp | last post by:
I have a class containing 5-6 member data. I want to provide a toString() method as a part of this class to help the users to do tracing. const std::string& toString() { std::string objectData ; objectData = "memberData1=" + memberData1 ; objectData += " memberData2=" + memberData2 ; objectData += " memberData3=" + memberData3 ; objectData += " memberData4=" + memberData4 ;
6
48153
by: John Wood | last post by:
If you override ToString(), why can't the default implementation of the string cast use that implementation for the object? It's a question people ask me time and time again.
2
1335
by: Jon | last post by:
Hello all, I think I must be missing something here as it seems it should be simple, but I've just tried to do a 'arrExtRep.ToString() (where arrItems is an ArrayList) and I get the error: error: 'arrExtRep.ToString' does not exist, however arrExtRep kicks out the value; Why's that and how can i overcome it?
101
19340
by: Sean | last post by:
Book I am reading says that Cstr() is best method for efficency and safety however it doesnt compare that method of the .ToString() method. Which is best. Thanks
25
2259
by: John A Grandy | last post by:
In .NET v1.1.4322 , in a VS.NET application , has anyone ever run into the bizarre situation where at runtime .NET believes that the ToString() method does not exist ... Sometimes this problem will show up as a runtime exceptions, sometimes this problem will only be clear via QuickWatch in Debug mode But the error message is always identical : "error: '{object name}.ToString' does not exist:"
11
441
by: etam | last post by:
Hi, why I can not override it? This line: virtual String^ ToString() override = Object::ToString; produces this error: cannot override base class method 'System::Object::ToString'. Why is that?
7
2781
by: John | last post by:
Hi I have a WinForm app with a bound form. When user enters a value in field rateid I lookup the respective rate amount from a table and assign it to field rate.I am using the DLookup function to achieve this (full code given below). This function returns a value of type object so I need to convert it to string. If I use the function as below (using ToString) it works fine; Me.txtRate.Text = DLookup(<parameters here>).ToString
19
2753
by: Michael C | last post by:
If we have something like this object x = null; MessageBox.Show(x.ToString()) we get an error. That kindof makes sense but there is no reason the behaviour couldn't be to return an empty string. When we call x.ToString we are really calling a function like this: class Object
38
1846
by: tshad | last post by:
In VS 2008, why doesn't ToString require "()". If I have Option Strict On on why can I do both: selectedIndex.ToString() selectedIndex.ToString or sQuery = temp.ToUpper().IndexOf("friend")
0
10564
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10365
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11624
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
12065
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
11156
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8728
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7894
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6678
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4954
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.