int LineInExcel;LineInExcel = ComboBox1->ItemIndex + 1; // Если данные из Excel заносились с 1 строкиLineInExcel = ComboBox1->ItemIndex + 5; // Если данные из Excel заносились с 5 строки
int IndexLines[3];ComboBox1->Lines->Add(data); // Данные Excel из 3 строкиIndexLines[0] = 3; // Запоминаем индекс строкиComboBox1->Lines->Add(data); // Данные Excel из 8 строкиIndexLines[1] = 8; // Запоминаем индекс строкиComboBox1->Lines->Add(data); // Данные Excel из 123 строкиIndexLines[2] = 123; // Запоминаем индекс строки // Определение индексаLineInExcel = IndexLines[ComboBox1->ItemIndex]
n=1; shs=App.OlePropertyGet("Cells").OlePropertyGet("Cells",n,1); res=shs.OlePropertyGet("Text"); ComboBox1->Items->Add(AnsiString(res)); LineInExcel=ComboBox1->ItemIndex+1; Label10->Caption=LineInExcel;
void __fastcall TForm1::ComboBox1Change(TObject *Sender){ int LineInExcel = ComboBox1->ItemIndex+1; Label10->Caption = IntToStr(LineInExcel);}
shs=App.OlePropertyGet("Cells").OlePropertyGet("Cells",LineInExcel,3); res=shs.OlePropertyGet("Text");
void __fastcall TForm1::ComboBox1Change(TObject *Sender){ LineInExcel = ComboBox1->ItemIndex+1; App.OlePropertyGet("Workbooks").OlePropertyGet("Item",1); Sh=App.OlePropertyGet("Worksheets"); shs=Sh.OlePropertyGet("Item",1); shs.OleProcedure("Activate"); shs=App.OlePropertyGet("Cells").OlePropertyGet("Cells",LineInExcel,2); res=shs.OlePropertyGet("Text"); ce=StrToFloat(res); shs=App.OlePropertyGet("Cells").OlePropertyGet("Cells",LineInExcel,3); res=shs.OlePropertyGet("Text"); mu=StrToFloat(res); }
void __fastcall TForm1::ComboBox1Change(TObject *Sender){ if(ComboBox1->ItemIndex = -1) return; LineInExcel = ComboBox1->ItemIndex+1; App.OlePropertyGet("Workbooks").OlePropertyGet("Item",1); Sh=App.OlePropertyGet("Worksheets"); shs=Sh.OlePropertyGet("Item",1); shs.OleProcedure("Activate"); shs=App.OlePropertyGet("Cells").OlePropertyGet("Cells",LineInExcel,2); res=shs.OlePropertyGet("Text"); ce=StrToFloat(res); shs=App.OlePropertyGet("Cells").OlePropertyGet("Cells",LineInExcel,3); res=shs.OlePropertyGet("Text"); mu=StrToFloat(res); }
if(ComboBox1->ItemIndex == -1) return;