473,795 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1905
"RP" <rp*********@gm ail.comwrote in message
news:11******** **************@ z24g2000prh.goo glegroups.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
3347
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 behalf. Now, when a client requests for an object to be created, I pass back a pointer to the object (from server memory address scope) as a "long integer". To the client, this is just an ID for the object they wish to access. From then on,...
12
1730
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 against sign extension. But left-shifting will always fill vacated bits with zero (assuming the right operand is nonnegative and less than the number of bits in the left expression's type). So how is the cast useful?
9
2372
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
17583
by: jeff | last post by:
unsigned long a = ...; long b = (long)a; while a overflows, what is the result of b? Thank you.
12
2697
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: 1234UL Are there -- in general -- any semantic differences in using casts versus suffixes? --Ralf
5
1639
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 for the "long" int. Apparently, the "long" needs to be a pointer since the thread was passed the "this" pointer for the main dialog. And the "long" is declared in the main dialog class. If it is declared as a local variable, there is an Assertion...
9
2606
by: Joe | last post by:
I need to cast the correct way HMENU mymenu; int stuff; .... stuff=(int)(long)(HMENU)mymenu; ....
18
2216
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 something into somthing else'. Example: double d=9.99; long l=(double)d; On the other hand 'casting' means: 'Treating something as something else without change'. For instance when casting function pointers.
5
2542
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 x = 0;
8
5497
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 _Tmp = (_Bfl == ios_base::oct || _Bfl == ios_base::hex) ? (long)(unsigned short)_Val //<-This Line : (long)_Val; Is there any profound reason why they "Double" casting the _Val? Thanks.
0
9672
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
10215
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
10165
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
10001
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
7541
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
6783
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
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
3727
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.