Click here to Skip to main content
15,904,339 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Accessing vector in another class?? Pin
Richard MacCutchan16-Nov-10 1:40
mveRichard MacCutchan16-Nov-10 1:40 
GeneralRe: Accessing vector in another class?? Pin
AmbiguousName16-Nov-10 2:14
AmbiguousName16-Nov-10 2:14 
QuestionCan i use Property Page as a dialog Box? Pin
Le@rner15-Nov-10 20:11
Le@rner15-Nov-10 20:11 
AnswerRe: Can i use Property Page as a dialog Box? Pin
Cedric Moonen15-Nov-10 20:33
Cedric Moonen15-Nov-10 20:33 
GeneralRe: Can i use Property Page as a dialog Box? Pin
Le@rner15-Nov-10 20:49
Le@rner15-Nov-10 20:49 
GeneralRe: Can i use Property Page as a dialog Box? Pin
Cool_Dev15-Nov-10 21:27
Cool_Dev15-Nov-10 21:27 
GeneralRe: Can i use Property Page as a dialog Box? Pin
Le@rner15-Nov-10 23:09
Le@rner15-Nov-10 23:09 
GeneralRe: Can i use Property Page as a dialog Box? Pin
Cool_Dev15-Nov-10 23:30
Cool_Dev15-Nov-10 23:30 
AnswerRe: Can i use Property Page as a dialog Box? Pin
Alain Rist16-Nov-10 5:21
Alain Rist16-Nov-10 5:21 
AnswerRe: Can i use Property Page as a dialog Box? Pin
David Crow16-Nov-10 3:55
David Crow16-Nov-10 3:55 
QuestionHow can use it in List Ctrl? Pin
Le@rner15-Nov-10 18:10
Le@rner15-Nov-10 18:10 
AnswerRe: How can use it in List Ctrl? Pin
Cool_Dev15-Nov-10 21:34
Cool_Dev15-Nov-10 21:34 
GeneralRe: How can use it in List Ctrl? Pin
Le@rner15-Nov-10 21:38
Le@rner15-Nov-10 21:38 
GeneralRe: How can use it in List Ctrl? Pin
Cool_Dev15-Nov-10 22:23
Cool_Dev15-Nov-10 22:23 
AnswerRe: How can use it in List Ctrl? Pin
Code-o-mat15-Nov-10 21:38
Code-o-mat15-Nov-10 21:38 
GeneralRe: How can use it in List Ctrl? Pin
Le@rner15-Nov-10 21:40
Le@rner15-Nov-10 21:40 
QuestionHow to tell when a view loses focus when the user has the right mouse button down and moves out of the view? Pin
Paul Belikian15-Nov-10 9:28
Paul Belikian15-Nov-10 9:28 
AnswerRe: How to tell when a view loses focus when the user has the right mouse button down and moves out of the view? Pin
Code-o-mat15-Nov-10 10:05
Code-o-mat15-Nov-10 10:05 
GeneralRe: How to tell when a view loses focus when the user has the right mouse button down and moves out of the view? Pin
Paul Belikian15-Nov-10 11:14
Paul Belikian15-Nov-10 11:14 
GeneralRe: How to tell when a view loses focus when the user has the right mouse button down and moves out of the view? Pin
Code-o-mat15-Nov-10 11:40
Code-o-mat15-Nov-10 11:40 
GeneralRe: How to tell when a view loses focus when the user has the right mouse button down and moves out of the view? Pin
Paul Belikian15-Nov-10 13:04
Paul Belikian15-Nov-10 13:04 
GeneralRe: How to tell when a view loses focus when the user has the right mouse button down and moves out of the view? Pin
Code-o-mat15-Nov-10 21:33
Code-o-mat15-Nov-10 21:33 
Question_unresolved external symbol error?? Pin
AmbiguousName15-Nov-10 9:20
AmbiguousName15-Nov-10 9:20 
AnswerRe: _unresolved external symbol error?? Pin
«_Superman_»15-Nov-10 9:26
professional«_Superman_»15-Nov-10 9:26 
AnswerRe: _unresolved external symbol error?? Pin
Stephen Hewitt15-Nov-10 18:34
Stephen Hewitt15-Nov-10 18:34 
As «_Superman_» said, you've got lots of problems here. Firstly note these lines:
LPTSTR Array[];
//using loop I added data to it..like
Arrar[index] = StudentName;//StudentName = some var


You haven't allocated any storage for the array! Ask youself how big it is! You really should use a std::vector[^] (as «_Superman_» suggested), especially since you don't seem to have a grasp of basic memory managment. Try something like this:
 
MyClass.h
-----------
// ...
#include <string>
#include <vector>
// ...
extern std::vector<std::string> Array;
// ...
 
MyClass.cpp
-----------
// ...
#include "MyClass.h"
// ...
std::vector<std::string> Array;
// ...
 
MyProjDlg.cpp
-------------
// ...
#include "MyClass.h"
// ...
BOOL CMyProjDlg::OnInitDialog()
{
     // How to add to the array.
     Array.push_back("String 1");
     Array.push_back("String 2");
 
     // Using the array.
     Listbox.AddString(Array[index].c_str());
         // NOTE: I have to use string::c_str() because MFC's list box needs raw C-strings (it isn't aware of <code>std::string</code>s).
}

Steve

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.