473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

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 996
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****************@TK2MSFTNGP05.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.com> wrote in message
news:O0**************@TK2MSFTNGP03.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****************@TK2MSFTNGP05.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
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) :...
5
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...
5
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
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: ...
0
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...
3
by: R Reyes | last post by:
Error: Unable to cast object of type 'ASP.CompanyDirectory_aspx' to type 'CompanyDirectory'. Code: clsCompanyDirectory = (CompanyDirectory)Context.Handler;...
2
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...
4
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...
6
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 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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,...
0
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...

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.