C++/an array of pointers
I know that you asked that I stay away from MFC questions, but my program has multiple edit boxes and I would like to make an array of the edit boxes. Since MSVC++ 6 doesn't allow arrays of edit boxes directly, can I make an array of pointers to the edit boxes:
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_FIRST)?
I can't seem to make this work, but can you suggest something? How should I initialize an array of pointers?
Thanks in advance for your help,
Hi Neil, thank you for the question.
Sorry for the delay in responding, I had to refresh a little bit on MFC. I was unable to find documentation about not being able to create an array of edit boxes in VS6.
Do you know how many edit boxes you are going to have in your app so you can allocate an array?
I'd try this:
CEdit* array = new CEdit[numEditsInApp];
array = GetDlgItem(ID);
Sometimes when you try and allocate an array statically it will throw an error about trying to allocate an array of size 0, so you have to use new.
Try something like that and see if it helps.
I hope this information was helpful.