473,491 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Copying Data from an Edit Control to a variable

29 New Member
Hie Team.

i am copying data from an EditControl called IDC_EDIT1 to a variable called ReqInfo.Amount

i am using the followong code:
Expand|Select|Wrap|Line Numbers
  1.  
  2. CEdit *DSP;
  3. CString text;
  4.  
  5. DSP = reinterpret_cast<CEdit *>(GetDlgItem(AMOUNT));
  6. DSP->GetWindowTextW(text);
  7.  
  8. if(text.GetLength() == 0)
  9. {
  10.  SetDlgItemText(IDC_STATIC_NOTIFY,L"Field is Blank");
  11.  return;
  12. }
  13. else
  14. {
  15.   sprintf_s(ReqInfo.Amount, 15,"%s",CT2CA(text));
  16.  
  17.   ReqInfo.Amount[text.GetLength()] = 0;
  18. }
  19.  
what i would like to ask is "is there any other way to do this"
i am finding it hard to follow this code
Oct 13 '11 #1
2 2848
johny10151981
1,059 Top Contributor
your main code to get the text from your text edit control is
Expand|Select|Wrap|Line Numbers
  1. CEdit *DSP;
  2. CString text;
  3.  
  4. DSP = reinterpret_cast<CEdit *>(GetDlgItem(IDC_EDIT1));
  5. DSP->GetWindowTextW(text);
  6.  
Oct 18 '11 #2
tawanda diza
29 New Member
hie Johny.

how else can i save the contents of that dialogue beside using

Expand|Select|Wrap|Line Numbers
  1. sprintf_s(ReqInfo.Amount, 15,"%s",CT2CA(text));
  2.  
  3.   ReqInfo.Amount[text.GetLength()] = 0;
  4.  
THANKS
Oct 18 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3559
by: Aaron Ackerman | last post by:
I am using typed datasets in an N-Tier Windows app using VB.NET. I know this posting cannot be fully explained in a single post that is why I am asking for someone to point me to a real world...
4
8363
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
6
4180
by: beowulfs | last post by:
Here's what I've got: I've got a form with combo boxes. you can select already existing company names or type in new ones. if you type in a new one, it prompts you to double click the combo...
1
2079
by: david | last post by:
Anybody could give me hint how use this control in asp.net web form. The problem is: I try to use COM component in my web form app by using MS training kit for windows form application. I would...
1
3451
by: Kostis | last post by:
Hello there! I have created a windows application in VB.NET and I want to retrieve data from an access database. I create the OleDbConnection, an OleDbAdapter, a dataset and finally a Data Form...
3
2585
by: Panos | last post by:
Hi all, I can't clear a Masked edit control. I use it to input dates, so I have defined the mask as "##/##/####". I use the the well known meb.mask="" meb.text="" , but nothing happens. Does...
3
1318
by: Sridhar | last post by:
Hi, I am having a trivial problem which is not that important but I would like to know if I am missing something. I have created a user control. When I drag the user control into one of the web...
2
2319
by: Mick_fae_Glesga | last post by:
Hello everyone! OK, I'm writing a windows program that requires the user to enter Cyrillic characters into an Edit control. But, I can't seem to get the Cyrillic characters to appear in the...
5
3444
by: shakthi | last post by:
Hi all, Am new to MFC appilcation programming.Plese tell me how to display a file with its path that is chosen from a file dialog.Am trying to create a dialog box displaying a list of...
2
3308
by: crapycoder | last post by:
hi all, please help....!! i have added a kodak image edit control on my form. when i click get image button, "abc.img" will be displayed. i have a button named "copy to clipboard". when...
0
7146
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
7183
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...
0
7356
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...
0
5448
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
4573
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...
0
3084
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...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
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 ...
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.