1
insert(int,String)
을 사용하여 TListView에 문자열을 삽입하려고하면 혼란 스럽습니다. 이와TListView를 사용하여 범위를 벗어나는 인덱스 나열
void __fastcall TFrmNewPeta::showDefaultRute()
{
std::string line;
std::ifstream ifs;
wisata.savedefaultT4Awal("DefaultDataAwal");
wisata.savedefaultT4Jarak("DefaultDataJarak");
wisata.savedefaultT4Tujuan("DefaultDataTujuan");
ifs.open("DefaultDataAwal");
try{
if(ifs.is_open())
{
for(int indexfile=0;std::getline(ifs,line);++indexfile)
{
ListItemnew = ListView1->Items->Add();
ListItemnew->Caption = String(IntToStr(indexfile+1));
ListItemnew->SubItems->Insert(indexfile,line.c_str());
//cbxtest->Items->Insert(indexfile,line.c_str()); //successfull
}
}
}__finally{
ifs.close();
}
}
컴파일러가 여러 번 밖으로 방법을 찾아야하지만이 같은 결과를 얻었다 내가 시도했습니다 "List Index out of bounds (1)"
말한다 :
여기 내 코드입니다.
하지만이 제품은 ComboBox로 테스트 할 때 잘 작동하기 때문에 궁금합니다.
cbxtest->Items->Insert(indexfile,line.c_str());
내 코드에 문제가 있다면?
Ouggh 도움을 희망 감사를 시도 –