473,382 Members | 1,635 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,382 software developers and data experts.

Cast to long

RP
I am using C# 2005 with Access XP.

I have a column with a LONG INTEGER data type. I have a class which
has a property:
---------------------------------------------------
Public long BPLNo
{
Get
{
return _BPLNo;
}

Set
{
_BPLNo = value;
}
}
--------------------------------------------------

While assigning value to this property, I am using following code, but
it is generating error of cast:

Class.BPLNo = Int64 (txtBPLNo.Text.ToString());

Nov 8 '07 #1
1 1890
"RP" <rp*********@gmail.comwrote in message
news:11**********************@z24g2000prh.googlegr oups.com...
While assigning value to this property, I am using following code, but
it is generating error of cast:

Class.BPLNo = Int64 (txtBPLNo.Text.ToString());
Try it like this:

Class.BPLNo = Convert.ToInt64(txtBPLNo.Text);

Or better still:

Int64 result;
bool success = Int64.TryParse(txtBPLNo.Text, out result);
if (success)
Class.BPLNo = result;
else
//The value typed in txtBPLNo is not recognized as an Int64 value.


Nov 8 '07 #2

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

Similar topics

31
by: Jamie Burns | last post by:
Hello, I am writing a client / server application. There is 1 server, and many clients. The server processes requests from each client, and typically creates and manipulates C++ objects on their...
12
by: Martin | last post by:
Two questions relating to FAQ answer 12.42. (1) In the statement s.i16 |= (unsigned)(getc(fp) << 8); i16 is declared int. The reason for casting to (unsigned) is explained as guarding...
9
by: Nicolas Blais | last post by:
Hi, I have this following class which I use as a timer: #include <sys/time.h> using namespace std; class chrono { public: chrono() {};
10
by: jeff | last post by:
unsigned long a = ...; long b = (long)a; while a overflows, what is the result of b? Thank you.
12
by: Ralf | last post by:
If you want to explicitly state the type of an integer constant, you basically have two options. Either you use an explicit cast, as in: (unsigned int) 1234 or you use the UL suffixes, as in:...
5
by: cdg | last post by:
I am trying to write a section of code that uses a worker thread and would need a "post message" to post a "long" integer to the receiving function. However, I am not sure how to write the cast...
9
by: Joe | last post by:
I need to cast the correct way HMENU mymenu; int stuff; .... stuff=(int)(long)(HMENU)mymenu; ....
18
by: Felix Kater | last post by:
I haven't been thinking about it for years but recently I've stumbled on the fact that 'casting' is actually doing (at least) two different things: On the one hand 'casting' means: 'Change...
5
by: aaragon | last post by:
Hi everyone, I wrote a very simple function to try to understand the casting of variables in C++. The function is function foo() { std::vector<inttest(100); randomize(test); unsigned long...
8
by: ManicQin | last post by:
Hi, I've browsed the STL code a bit and stumble upon the next line (in the operator << overload of both long and short outputs - the line is for checking does the input is a manipulator) long...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.