GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Oct-2009, 03:13
alice09 alice09 is offline
New Member
 
Join Date: Oct 2009
Posts: 6
alice09 is on a distinguished road

How get textBox values from subTabControl into maintabControl


Hi all,

I want to get textBox values from subTabControl into maintabControl. Follwing is my code that i written in mainTabControl:

IDC_EDITMCNO_SUB is textbox in subTabControl and MacNo_Sub is variable for IDC_EDITMCNO_SUB, i trying to get value from IDC_EDITMCNO_SUB and assign the value to textbox in mainTabControl which namely IDC_EDITMCNO_MAIN. McNo_Main is variable for IDC_EDITMCNO_MAIN.

CPP / C++ / C Code:
// Get text box values
CString MacNo_Sub;
GetDlgItemText(IDC_EDITMCNO_SUB ,MacNo_Sub);
CString McNo_Main = MacNo_Sub;
SetDlgItemText(IDC_EDITMCNO_MAIN, McNo_Main);

when compile this program, it succeeded and no return error. but when i run this program, it does't return any value in IDC_EDITMCNO_MAIN.

can anyone help me to get the value from IDC_EDITMCNO_SUB??
Please show me some guide to solve this problem..its very urgent for me..
I very appreciate your help..
Thanks very much .

Regards:
Alice
  #2  
Old 27-Oct-2009, 04:42
Mexican Bob's Avatar
Mexican Bob Mexican Bob is offline
Member
 
Join Date: Mar 2008
Location: Chicxulub, Yucatán
Posts: 226
Mexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the rough

Re: How get textBox values from subTabControl into maintabControl


I don't have much interest in MFC-based programming. I was going to refer you to the MFC forum section, but once there, I saw that you didn't appear to get the help that you wanted and came here instead. In such cases, you may want to clearly state your platform, compiler/tools and that you are using MFC. You may also want to specify whether the application is a CDialog-based or some other derived type to give a bit more insight into your problem domain.

I suspect that you have decided on a CDialog-based application and are having problems retrieving data from controls found on the dialog.

One method is to create a CString member variable for the control and then implement the OnChanged (I believe) handler for your CEdit (or similar) control. Whenever changed, update the CString with the contents. Note that this is not an incredibly efficient method, rather, it is a matter of convenience and does not delegate the responsibility to something like a pushbutton press.

More efficient would probably be a "string stream" type class, of which I'm sure there is one in MFC.

My recommendation would be to get the code working and then look for ways to optimize it. Note along the way that there are areas of inefficiency that should be adequately commented; probably using the TODO convention.

For now, you may simply want to start with something like:

CPP / C++ / C Code:
CWnd* pMyEdit = GetDlgItem(IDC_EDITMCNO_SUB);
CString text;
pMyEdit->GetDlgItemText(IDC_EDITMCNO_SUB, text);
// TODO: use "text"

Note that I was unable to test any of this code.


MxB
  #3  
Old 27-Oct-2009, 21:09
alice09 alice09 is offline
New Member
 
Join Date: Oct 2009
Posts: 6
alice09 is on a distinguished road

Re: How get textBox values from subTabControl into maintabControl


Hi,
thanks very much for your reply..
i try to work on it..
thanks again..
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert RGB to luma and Chroma component maximuz C Programming Language 17 12-Feb-2008 13:54
Please help me to convert a simple C++ program into an object-oriented one. zekesteer C++ Forum 5 05-Jan-2008 11:05
php/mysql getting column values from db into textbox on a form mrjameer MySQL / PHP Forum 6 23-Aug-2006 09:21
Inpage values in code behind ajitham .NET Forum 0 25-Jan-2006 06:25
paasing values in fk_t_diectories zuzupus MySQL / PHP Forum 6 12-Aug-2003 08:12

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:44.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.