473,667 Members | 2,642 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reference and cast error

in my asp.net app, i get following two errors some times, these errors
occasionally occurs

please let me know if anyone has any idea why they occur

Cast from string "" to type 'Integer' is not valid

Object reference not set to an instance of an object

May 30 '06 #1
2 1003
What integer value do you think an empty string represents? Dotnet can't
decide it for you. You need to check the string on empty before casting it
to integer.

The object reference error means the variable you use is null. Check your
code, likely you need to create it.

Eliyahu

"Vikram" <aa@aa> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
in my asp.net app, i get following two errors some times, these errors
occasionally occurs

please let me know if anyone has any idea why they occur

Cast from string "" to type 'Integer' is not valid

Object reference not set to an instance of an object

May 30 '06 #2
No but same code works fine everytime, only some time it gives error and
user has to relogin ino the app. Is this due to session expiry or viewstate
curruption?
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:O0******** ******@TK2MSFTN GP03.phx.gbl...
What integer value do you think an empty string represents? Dotnet can't
decide it for you. You need to check the string on empty before casting it
to integer.

The object reference error means the variable you use is null. Check your
code, likely you need to create it.

Eliyahu

"Vikram" <aa@aa> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
in my asp.net app, i get following two errors some times, these errors
occasionally occurs

please let me know if anyone has any idea why they occur

Cast from string "" to type 'Integer' is not valid

Object reference not set to an instance of an object


May 30 '06 #3

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

Similar topics

3
3840
by: Stub | last post by:
Question 1: class Count { public: Count() : id(n++) { cout << id << " default ctor" << endl; } Count(Count const&) : id(n++) { cout << id << " copy ctor" << endl; Count (Count const& src) : v(src.v) { cout << "Count(Count const&) " << v << "\n"; } };
5
3743
by: klaus triendl | last post by:
hi, recently i discovered a memory leak in our code; after some investigation i could reduce it to the following problem: return objects of functions are handled as temporary objects, hence their dtor is called immediately and not at the end of the function. to be able to use return objects (to avoid copying) i often assign them to a const reference. now, casting a const return object from a function to a non-const reference to this...
5
1339
by: Basil | last post by:
Hello. Compiler BCB60. There is a simple example: class a1 { int v; public: a1 ():v (0) {} a1 (int v1):v (v1) {}
7
5753
by: Santi | last post by:
I have two classes: Product and Fruit which inherits from Product. If I try to narrow the reference to the base type by a cast, I always get a reference to the inherited type. For example: Fruit lemon = new Fruit(); Product prod = (Product)lemon; // Now prod is a Fruit Type!! I want to get a Product reference from a Fruit object, is it possible? thank you.
0
1241
by: MIGUEL | last post by:
Hi all! Be patient because what I'm going to explain all of you it's more than very strange. I've developed a webservice project that contains two classes. One of them is going to act as a SOAP header, and the other class is the main class containing all the web methods. Besides, the project contains two references pointing at two normal DLLs built also with VS .NET 2003. This references are needed because the web methods use them in
3
2621
by: R Reyes | last post by:
Error: Unable to cast object of type 'ASP.CompanyDirectory_aspx' to type 'CompanyDirectory'. Code: clsCompanyDirectory = (CompanyDirectory)Context.Handler; getCompanyProfile(Strings.ConvertToInt(clsCompanyDirectory.CompanyIDValue)); Question: I have other pages with the exact same code and it does not error. Why would this error? Am I missing something? How can the same page not be cast on itself if it's the same type? Or maybe I...
2
2369
by: Johan | last post by:
Hi, I'm writing an PowerPoint Add-In using C# which adds a toolbar and a button. When the user clicks the button, an activex control is inserted into the presentation. Is it possible to somehow type cast the Microsoft.Office.Interop.PowerPoint.Shape or the shape.OLEFormat.Object to an instance of the interop-class created for my activex control by visual studio? I need to do this in order to transfer the state of another activex control...
4
24566
by: =?Utf-8?B?TGVvIExleXM=?= | last post by:
Hi, The code below generates a compile error on line 3 (dim d...) Dim o As Object = "1900-01-01" Dim s As String = TryCast(o, String) Dim d As DateTime = TryCast(o, DateTime) The error is : TryCast operand must be reference type, but 'Date' is a value type.
6
8441
by: GiJeet | last post by:
Problem using AS operator to cast Tag property Hello, I’m using the Tag property of a menu item to hold an enum value of a PictureBoxSizeMode. Eg: this.menuImageStretch.Tag = System.Windows.Forms.PictureBoxSizeMode.StretchImage; now in the ProcessImageClick method I check to make sure the Tag propety is not null and cast from type Object to PictureBoxSizeMode
0
8367
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
8889
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
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...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
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
4202
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...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
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 we have to send another system
2
1779
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.