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

C / C++ / MFC

 
GeneralRe: Window Programming (Saving Results) Pin
Nish Nishant29-May-02 7:02
sitebuilderNish Nishant29-May-02 7:02 
GeneralCount Number of Items in a struct Pin
Anton A. Loukine29-May-02 6:36
Anton A. Loukine29-May-02 6:36 
GeneralRe: Count Number of Items in a struct Pin
Rama Krishna Vavilala29-May-02 6:49
Rama Krishna Vavilala29-May-02 6:49 
GeneralRe: Count Number of Items in a struct Pin
Anton A. Loukine29-May-02 6:49
Anton A. Loukine29-May-02 6:49 
GeneralRe: Count Number of Items in a struct Pin
Rama Krishna Vavilala29-May-02 7:23
Rama Krishna Vavilala29-May-02 7:23 
GeneralRe: Count Number of Items in a struct Pin
Rama Krishna Vavilala29-May-02 6:55
Rama Krishna Vavilala29-May-02 6:55 
GeneralRe: Count Number of Items in a struct Pin
Anton A. Loukine29-May-02 6:50
Anton A. Loukine29-May-02 6:50 
GeneralRe: Count Number of Items in a struct Pin
Joaquín M López Muñoz29-May-02 8:47
Joaquín M López Muñoz29-May-02 8:47 
Although others have posted very smart ways to have the task you're asking for accomplisedh automatically, please let me warn you'd better stay away of nifty tricks and stick to the boring sequence of resettings. If you ever add another item to your struct, you'd probably have to remember all the places scattered in your code where you put that. Instead, add a method to your struct like this:
struct BBG_SECURITIES {
  ...
  void Reset()
  {
    nRecords = 0; // I guess you meant 0 instead of NULL
    sName.SetSize(0);
    ... //all of the others
  }
};
and use it accordingly. You can do it even better: as CStrings are constructed to the empty string by default, you can have it like:
struct BBG_SECURITIES {
  ...
  BBG_SECURITIES()
  {
    nRecords = 0; // all other member properly cted by default
  }  
  void Reset()
  {
    BBG_SECURITIES clean_struct; // have a fresh item
    (*this)=clean_struct; // and copy to the current object
  }
};
The ability to inspect the contents of a class (its members, methods, etc.) is called reflection and alas is lacking in C++ (altough Java and C# do have it and it's magical for some uses.)

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
GeneralRe: Count Number of Items in a struct Pin
Michael Dunn29-May-02 17:56
sitebuilderMichael Dunn29-May-02 17:56 
GeneralTrick or thread Pin
Zizilamoroso29-May-02 6:24
Zizilamoroso29-May-02 6:24 
GeneralRe: Trick or thread Pin
Rama Krishna Vavilala29-May-02 6:50
Rama Krishna Vavilala29-May-02 6:50 
GeneralRe: Trick or thread Pin
Zizilamoroso29-May-02 7:03
Zizilamoroso29-May-02 7:03 
GeneralRe: Trick or thread Pin
Nish Nishant29-May-02 7:14
sitebuilderNish Nishant29-May-02 7:14 
GeneralRe: Trick or thread Pin
Zizilamoroso29-May-02 8:11
Zizilamoroso29-May-02 8:11 
QuestionScroll in ListControl ? Pin
dlhson29-May-02 5:50
dlhson29-May-02 5:50 
AnswerRe: Scroll in ListControl ? Pin
Prem Kumar29-May-02 6:14
Prem Kumar29-May-02 6:14 
QuestionHow does a modal dialog work (message pump)? Pin
29-May-02 4:29
suss29-May-02 4:29 
AnswerRe: How does a modal dialog work (message pump)? Pin
Joaquín M López Muñoz29-May-02 4:58
Joaquín M López Muñoz29-May-02 4:58 
GeneralRe: How does a modal dialog work (message pump)? Pin
Maximilien29-May-02 5:30
Maximilien29-May-02 5:30 
GeneralRe: How does a modal dialog work (message pump)? Pin
Joaquín M López Muñoz29-May-02 5:49
Joaquín M López Muñoz29-May-02 5:49 
GeneralRe: How does a modal dialog work (message pump)? Pin
29-May-02 5:28
suss29-May-02 5:28 
GeneralRe: How does a modal dialog work (message pump)? Pin
Joaquín M López Muñoz29-May-02 8:29
Joaquín M López Muñoz29-May-02 8:29 
GeneralRe: How does a modal dialog work (message pump)? Pin
29-May-02 13:13
suss29-May-02 13:13 
GeneralRe: How does a modal dialog work (message pump)? Pin
29-May-02 18:20
suss29-May-02 18:20 
GeneralRe: How does a modal dialog work? Code snippets Pin
29-May-02 13:36
suss29-May-02 13:36 

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.