Guest_imported
New member
- Jan 1, 1970
- 0
HI,
In one function of my programm, I open a dialog box with 2 lists and 2 buttons.
in the first list, I have the title of the differents opened windows in my programm (MDI application).
When I click on the first button, I would like that the selected item in my first list was transfered in my second list (in this function, the user make a choice of differents files he needs).
With the other button, the user can cancel his choice ( the selected item in the second list
is transfered in the first list)
m_listBox : first listbox
m_listBox2 : second listbox
aStrings : a CStringArray with the title of opened windows
aStrings2 : a CStringArray with the items of the second list
I have made this code with Jeffray's help for the first button function
void CMulxDlg::OnEinfugen()
{
int i = 0;
int j = 0;
while(i < m_listBox.GetCount())
{
if (m_listBox.GetSel(i) != 0)
{
j = i;
m_listBox2.AddString(aStrings);
m_listBox.DeleteString(i);
aStrings.RemoveAt( i, 1 );
i++;
}
else
i++;
}
aStrings2.Add(aStrings[j]); /* assertion failed cause of this line */
}
and this code for the second button function
void CMulxDlg::OnEntfernen()
{
int i = 0;
while(i < m_listBox2.GetCount())
{
if (m_listBox2.GetSel(i) != 0)
{
m_listBox.AddString(aStrings2);
m_listBox2.DeleteString(i);
aStrings2.RemoveAt( i, 1 );
i++;
}
else
i++;
}
}
When I select three files, I have an assertion failed.
I don't know why
I changeg my code but I have often assertion failed
Maybe my CStringArray aren't good initialized
Someone can help me ?
Thanks!
In one function of my programm, I open a dialog box with 2 lists and 2 buttons.
in the first list, I have the title of the differents opened windows in my programm (MDI application).
When I click on the first button, I would like that the selected item in my first list was transfered in my second list (in this function, the user make a choice of differents files he needs).
With the other button, the user can cancel his choice ( the selected item in the second list
is transfered in the first list)
m_listBox : first listbox
m_listBox2 : second listbox
aStrings : a CStringArray with the title of opened windows
aStrings2 : a CStringArray with the items of the second list
I have made this code with Jeffray's help for the first button function
void CMulxDlg::OnEinfugen()
{
int i = 0;
int j = 0;
while(i < m_listBox.GetCount())
{
if (m_listBox.GetSel(i) != 0)
{
j = i;
m_listBox2.AddString(aStrings);
m_listBox.DeleteString(i);
aStrings.RemoveAt( i, 1 );
i++;
}
else
i++;
}
aStrings2.Add(aStrings[j]); /* assertion failed cause of this line */
}
and this code for the second button function
void CMulxDlg::OnEntfernen()
{
int i = 0;
while(i < m_listBox2.GetCount())
{
if (m_listBox2.GetSel(i) != 0)
{
m_listBox.AddString(aStrings2);
m_listBox2.DeleteString(i);
aStrings2.RemoveAt( i, 1 );
i++;
}
else
i++;
}
}
When I select three files, I have an assertion failed.
I don't know why
I changeg my code but I have often assertion failed
Maybe my CStringArray aren't good initialized
Someone can help me ?
Thanks!