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

Basic Managed C++ questions

Hello,

I'm looking to teach myself managed C++. I'm trying to make a simple
application. How do I import the number from a text box into a variable
of data type long.

in vb i would do something like

dim var as long
var = textbox.text
and it would work. Now when i do in C++
long Number = 0;
Number = txtNum->Text;

I get errors stating that it can't convert from string to int. any
suggestions on how to do this?

Feb 28 '06 #1
5 2029
* all2neat:
[snip]

I get errors stating that it can't convert from string to int. any
suggestions on how to do this?


E.g. boost::lexical_cast (see www.boost.org).

Or, you can use a std::istringstream yourself.

Or, you can use the C library's functions, or whatever conversion
function you find most convenient.
PS: Please note that Managed C++ is outside the scope of this newsgroup.
Happily your question turned out to have nothing to do with Managed
C++, and so I could answer it in good conscience. Also, slightly
off-topic, note that Managed C++ has been supplanted by C++/CLI.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Feb 28 '06 #2
This would be off topic here.

Try the newsgroup:

microsoft.public.dotnet.languages.vc newsgroup.

--
EventStudio System Designer 2.5 - http://www.EventHelix.com/EventStudio
Sequence diagram based system design and object interaction modeling
tool.

Feb 28 '06 #3
Thanks to both.

Feb 28 '06 #4

all2neat wrote:
Hello,

I'm looking to teach myself managed C++.


Managed C++ and actual C++ have little in common; they are not the same
language. Here we talk about C++, not MS's bastardization of it. Any
answer you get here is likely to be completely unbeneficial to you. Go
to a microsoft .net newsgroup.

Feb 28 '06 #5
all2neat posted:
Hello,

I'm looking to teach myself managed C++. I'm trying to make a simple
application. How do I import the number from a text box into a variable
of data type long.

in vb i would do something like

dim var as long
var = textbox.text
and it would work. Now when i do in C++
long Number = 0;
Number = txtNum->Text;

I get errors stating that it can't convert from string to int. any
suggestions on how to do this?

Looks like you're using something like MFC.

I only every use the Windows API directly, so I'd probably use GetDlgItemInt
or GetDlgItemText.

You'll get much greater help on a Windows specific programming newsgroup.
-Tomás
Feb 28 '06 #6

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

Similar topics

1
by: Eric Twietmeyer | last post by:
Hello, I'm starting to investigate cs, managed c++ and interoperating with a very large unmanaged code base. We are going to use Windows Forms (written in cs) to replace our old fashioned GUI. ...
8
by: Grant Schenck | last post by:
Hello, I'm pretty new to C# and .NET. I've been tasked with creating an Internet Explorer toolbar. I implemented it and it works OK, however, because the toolbar has a notion of having to...
3
by: Jim H | last post by:
If there is a site someone can point me to that answers such basic questions, rather than taking up support's time posting answers, please let me know. I've developed C# .NET, unmanaged C++, and...
11
by: Lloyd Dupont | last post by:
(not I use 2.0, so new return a "normal" pointer and gcnew return a managed one, my question below regarding new concern plain standart C++ allocator) - if I use the default new operator, are all...
3
by: Tony Johansson | last post by:
Hello! I have some questions and I want to be sure about the :NET environment.. Question number 1: Is this right C++/CLI hasn't existed until in VS++ 2005(VC8) Question number 2: When you...
5
by: matt.keyes | last post by:
Hi all, If i compile my VC 6.0 code with the VC.NET 2003 compiler (unmanaged C++), then can the compiled executable be run on a machine without the ..NET architecture? Thanks!
3
by: phate53 | last post by:
How would I start doing simple 3d projects in visual basic .net? Does anyone have any good .NET websites that they could give me? Thanks
4
by: Goran Djuranovic | last post by:
Hi all, I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page. -...
20
by: =?Utf-8?B?VGhlTWFkSGF0dGVy?= | last post by:
Sorry to bring up a topic that is just flogging a dead horse.... but... On the topic of memory management.... I am doing some file parcing that has to be done as quick as posible, but what I...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.