Access members of another class?

  • Thread starter sweetjones
  • Start date
44
0

Main Question or Discussion Point

I'm using VS C++ 2005 in MFC, and I'm trying to access a member of another class. I'll try and make this as short as possible and still give the whole picture of what im trying to do. I created a SDI with the CFormView Class. I have a dialog with an edit control box with a CString variable(m_CustName) and a CEdit control(m_CtrlCustName). I've done this to store the name(m_ctrlCustName.GetWindowTextW(m_sCustName);). I have a button to go to the next dialog which is another CFormView Class. What I'm trying to do is take that m_CustName variable, for example, "John Doe," and make that the title of the next dialog when I click that button. This is just a piece of what I have in the next View Class, but it is not working:
CString strTitle = CustName->m_sCustName; // CustName is a pointer object of the first class
pDoc->SetTitle(strTitle); // pDoc is declared as a pointer object to my document class already

My program compiles, but when I press the button to go to the next dialog a Unhandled Exception pops up, and the "atlsimplestr.h" shows. Well, any help is appreciated. Let me know if you need more clarification or info. Thanx in Advance!!!
 

Answers and Replies

44
0
I figured out my problem. I was using the wrong *pointer object.
 

Related Threads for: Access members of another class?

Replies
1
Views
2K
  • Last Post
Replies
3
Views
796
Replies
1
Views
4K
Replies
7
Views
2K
  • Last Post
Replies
2
Views
2K
  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
4
Views
3K
  • Last Post
Replies
6
Views
710
Top