This is the program:
The Form has 3 TextBoxes and 1 Button. The user uses the keyboard to
enter a number in each of the two first TexBoxes, presses the Button,
and the sum of the numbers appears in the third TextBox.
In Borland Builder the OnClick event of the Button can look like this
(if the TextBoxes are named N1, N2 and N3):
void __fastcall TForm1::Button1 Click(TObject *Sender)
{
double A = N1->Text.ToDouble( );
double B = N2->Text.ToDouble( );
N3->Text=A+B;
}
In MS Visual C++ 2005 Express Edition I miss the ToDouble function. How
can it be done here? Can anyone help ?
Regards Knut 6 2017
Knut Olsen-Solberg wrote:
This is the program:
The Form has 3 TextBoxes and 1 Button. The user uses the keyboard to
enter a number in each of the two first TexBoxes, presses the Button,
and the sum of the numbers appears in the third TextBox.
In Borland Builder the OnClick event of the Button can look like this
(if the TextBoxes are named N1, N2 and N3):
void __fastcall TForm1::Button1 Click(TObject *Sender)
{
double A = N1->Text.ToDouble( );
double B = N2->Text.ToDouble( );
N3->Text=A+B;
}
In MS Visual C++ 2005 Express Edition I miss the ToDouble function. How
can it be done here? Can anyone help ?
Regards Knut
Take a look at std::strtod in <cstdlib>.
That should convert a string to a double. You'll have to pass it a
C-string though, but your text control surely has some conversion for this.
--John Ratliff
Knut Olsen-Solberg napisał(a):
This is the program:
The Form has 3 TextBoxes and 1 Button. The user uses the keyboard to
enter a number in each of the two first TexBoxes, presses the Button,
and the sum of the numbers appears in the third TextBox.
In Borland Builder the OnClick event of the Button can look like this
(if the TextBoxes are named N1, N2 and N3):
void __fastcall TForm1::Button1 Click(TObject *Sender)
{
double A = N1->Text.ToDouble( );
double B = N2->Text.ToDouble( );
N3->Text=A+B;
}
In MS Visual C++ 2005 Express Edition I miss the ToDouble function. How
can it be done here? Can anyone help ?
Regards Knut
double A = Double::Parse(T ext);
Regards Ryszard
Ryszard wrote:
Knut Olsen-Solberg napisał(a):
>This is the program: The Form has 3 TextBoxes and 1 Button. The user uses the keyboard to enter a number in each of the two first TexBoxes, presses the Button, and the sum of the numbers appears in the third TextBox.
In Borland Builder the OnClick event of the Button can look like this (if the TextBoxes are named N1, N2 and N3):
void __fastcall TForm1::Button1 Click(TObject *Sender) { double A = N1->Text.ToDouble( ); double B = N2->Text.ToDouble( );
N3->Text=A+B; }
In MS Visual C++ 2005 Express Edition I miss the ToDouble function. How can it be done here? Can anyone help ?
Regards Knut
double A = Double::Parse(T ext);
Regards Ryszard
Thanks!
Still I have a problem getting A+B back to N3->Text. Can you show me
this too?
Regards Knut
On Feb 20, 10:21 am, Knut Olsen-Solberg <k...@hist.nowr ote:
Ryszard wrote:
Knut Olsen-Solberg napisał(a):
This is the program:
The Form has 3 TextBoxes and 1 Button. The user uses the keyboard to
enter a number in each of the two first TexBoxes, presses the Button,
and the sum of the numbers appears in the third TextBox.
In Borland Builder the OnClick event of the Button can look like this
(if the TextBoxes are named N1, N2 and N3):
void __fastcall TForm1::Button1 Click(TObject *Sender)
{
double A = N1->Text.ToDouble( );
double B = N2->Text.ToDouble( );
N3->Text=A+B;
}
In MS Visual C++ 2005 Express Edition I miss the ToDouble function.
How can it be done here? Can anyone help ?
Regards Knut
double A = Double::Parse(T ext);
Regards Ryszard
Thanks!
Still I have a problem getting A+B back to N3->Text. Can you show me
this too?
Might be a better way of doing this but this ought to work:
N3->Text = Convert::ToStri ng(A + B, 10);
The 10 at the end means you want it in base 10, I hope this works for
non-integers too. By the way, this is kind of off-topic here, in the
future you should ask questions like these in a Microsoft/.Net-
specific newsgroup, perhaps microsoft.publi c.dotnet.langua ges.vc will
do.
--
Erik Wikström
Erik Wikström wrote:
On Feb 20, 10:21 am, Knut Olsen-Solberg <k...@hist.nowr ote:
>Ryszard wrote:
>>Knut Olsen-Solberg napisał(a): This is the program: The Form has 3 TextBoxes and 1 Button. The user uses the keyboard to enter a number in each of the two first TexBoxes, presses the Button, and the sum of the numbers appears in the third TextBox. In Borland Builder the OnClick event of the Button can look like this (if the TextBoxes are named N1, N2 and N3): void __fastcall TForm1::Button1 Click(TObject *Sender) { double A = N1->Text.ToDouble( ); double B = N2->Text.ToDouble( ); N3->Text=A+B; } In MS Visual C++ 2005 Express Edition I miss the ToDouble function. How can it be done here? Can anyone help ? Regards Knut double A = Double::Parse(T ext); Regards Ryszard
Thanks! Still I have a problem getting A+B back to N3->Text. Can you show me this too?
Might be a better way of doing this but this ought to work:
N3->Text = Convert::ToStri ng(A + B, 10);
The 10 at the end means you want it in base 10, I hope this works for
non-integers too. By the way, this is kind of off-topic here, in the
future you should ask questions like these in a Microsoft/.Net-
specific newsgroup, perhaps microsoft.publi c.dotnet.langua ges.vc will
do.
--
Erik Wikström
No, this did not work (maybe just a little correction needed?), but I
found something that worked:
T3->Text = (A+B).ToString( );
Thanks Knut
Knut Olsen-Solberg napisa³(a):
Ryszard wrote:
>Knut Olsen-Solberg napisa³(a):
>>This is the program: The Form has 3 TextBoxes and 1 Button. The user uses the keyboard to enter a number in each of the two first TexBoxes, presses the Button, and the sum of the numbers appears in the third TextBox.
In Borland Builder the OnClick event of the Button can look like this (if the TextBoxes are named N1, N2 and N3):
void __fastcall TForm1::Button1 Click(TObject *Sender) { double A = N1->Text.ToDouble( ); double B = N2->Text.ToDouble( );
N3->Text=A+B; }
In MS Visual C++ 2005 Express Edition I miss the ToDouble function. How can it be done here? Can anyone help ?
Regards Knut
double A = Double::Parse(T ext);
Regards Ryszard
Thanks!
Still I have a problem getting A+B back to N3->Text. Can you show me
this too?
Regards Knut
N3->Text = A.ToString();
Regards Ryszard This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John Ladasky |
last post by:
Hi, folks,
At the beginning of 2003, I was a frustrated computer user, and lapsed
programmer, with problems to solve that screamed for programming.
Thanks to the Python language and community, I am a programmer once
again.
My earlier solicitation to the computer world is here:
http://groups.google.com/groups?selm=c09b237b.0302060136.5683054e%40posting.google.com
|
by: Viviana Vc |
last post by:
How can I programatically do the equivalent of the following:
cacls "C:\Program Files\test" /T /G Everyone:f ?
Thanks,
Viv
|
by: Zheng Da |
last post by:
I don't know where should I ask the question, so send the email to this
group.
I choose this group, because I want to write the program with c++ :)
I want to write a program which support multiprotocol, but do not want
to write code for all protocols which I want to support. I plan I give
a interface and others give a module which implements a protocol, and
then the module can be inserted into my program without recompiling my
program....
|
by: Bore Biko |
last post by:
Dear,
I don't have enought money to by a original Visual C++,
so I use Visual C++ 6.0 Enterprise edition, this version
doesen't have a HELP.
Most of my friends programmers praise C++,
as a toll for GUI-s.For GUI-s I use ORACLE
tolls (when I work with databases), and Prolog++,
and Java...
But for me sems better use C++ becouse he is so
|
by: Alvin Lau |
last post by:
Can I write pocket PC bluetooth program by using C# ?
It seems so difficult to find the library?
If it is possible , where can i find the reference of these kind of
program ?
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
| |
by: Ilkka |
last post by:
I have created an C++ application with Windows Forms, ADO and SQL server
2005. Now I need to change something and started debugging the code. Then
suddenly I receive an error.
"An unhandled exception of type 'System.AccessViolationException' occurred
in mscorlib.dll
Additional information: Attempted to read or write protected memory. This is
often an indication that other memory is corrupt."
The progran ends on a windows form designer...
|
by: =?Utf-8?B?QW5kcmV3?= |
last post by:
I am simple tryint to learn how to use the ADO.NET code. Can anybody tell me
if I am using it right or not?
Imports System.Data.sqlclient
Imports System.Data
Public Class Form1
Inherits System.Windows.Forms.Form
|
by: Ben Keshet |
last post by:
I have a probably simple beginner's question -
I have a script that I am currently able to print its output. instead,
i want to write it into a file - I tried different versions of write()
but might have gotten the syntax wrong. the variable I want to write is
a line from a file I am reading:
"...
f = open('receptor.mol2', 'r')
line = f.readline()
|
by: Hongyu |
last post by:
Dear all:
I am trying to write to a file with full directory name and file name
specified (./outdir/mytestout.txt where . is the current directory)
in
C programming language and under Unix, but got errors of Failed to
open file ./outdir/mytestout.txt. Below is the code:
#include <stdio.h>
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |