Hello,
I'm trying to get the contents of dynamically created edit boxes into a vector of CStrings. It copies most of the entries, but leaves some of them out. I don't kow why.
here's the retreaval code:
Code:
//////////////////////////////////////////////////////////////////////
// COPY ALL THE SELECTED PARAMETERS FROM EDIT BOXES TO GLOBAL ARRAY //
// //
//////////////////////////////////////////////////////////////////////
CString str;
CEdit* pGetEdit[512];
for(i=0; i<FAD.nExpected; i++)
{
pGetEdit[i] = (CEdit*) GetDlgItem(i);
int len = pGetEdit[i]->LineLength();
pGetEdit[i]->GetLine(1,str.GetBuffer(len), len);
vars.vectParmSelected.push_back(str);
}
for(i=0; i<FAD.nExpected; i++)
{
fprintf(out, ">%s<\n", vars.vectParmSelected[i]);
}
fprintfs are just to check the output, the vector will be used for something else. GetDlgItem (i) => the i referes to the ID of the edit boxes, they are created like this:
Code:
CEdit *txtbox[512];
int x1=350, y=50, x2=450, h=20;
for (int i = 0; i < FAD.nExpected; i++)
{
txtbox[i] = new CEdit();
txtbox[i]->Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(x1,y,x2,y+h), this, i);
y += 22;
}
I'm not even sure if I'm doing it right, I'm pretty sure I'm not.