|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
|
|
Опции темы | Поиск в этой теме |
07.12.2013, 11:13 | #11 |
Пользователь
Регистрация: 11.11.2013
Сообщений: 17
|
Я связала ComboBox1 с ComboBox2, т.е. выбирая в ComboBox2 общежитие в ComboBox1 должны появится их названия. а в мемо2 люди, которые живут в этих общежитиях. Но возникла проблема: Как переделать strOb в TempListOb, strCom в TempListCom, strDate в TempListDate?
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "IniFiles.hpp" #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; int IniParam2; TStringList * InList = new TStringList; TStringList * OutList = new TStringList; int Pos1, Pos2, Pos3; String strBuf1, strBuf2, strFIO, strDate, strOb, strCom, strDen, strGod, strOut; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { //IniTempPath = Application->ExeName; } //--------------------------------------------------------------------------- void __fastcall TForm1::загрузкаClick(TObject *Sender) { InList->LoadFromFile("D:\\Work\\УТС 22 Д\\30.11.2013\\плюха.txt"); Memo1->Lines = InList; } //--------------------------------------------------------------------------- void __fastcall TForm1::действиеClick(TObject *Sender) { OutList->Sorted = true; OutList->Duplicates = dupIgnore; for (int i = 0; i < InList->Count; i++) { strBuf1 = InList->Strings[i]; Pos1 = Pos(',', strBuf1); strFIO = strBuf1.SubString(1, Pos1-1); Label1->Caption = strFIO; strBuf2 = Trim(strBuf1.SubString(Pos1+1, strBuf1.Length() - Pos1 + 1)) ; strBuf1 = strBuf2; Pos1 = Pos(' ', strBuf1); strOb = strBuf1.SubString(1, Pos1-2); Label2->Caption = strOb; strBuf2 = Trim(strBuf1.SubString(Pos1+1, strBuf1.Length() - Pos1 + 1)) ; strBuf1 = strBuf2; Pos1 = Pos(' ', strBuf1); strCom = strBuf1.SubString(1, Pos1-2); Label3->Caption = strCom; strBuf2 = Trim(strBuf1.SubString(Pos1+1, strBuf1.Length() - Pos1 + 1)) ; strBuf1 = strBuf2; Pos1 = Pos(',', strBuf1); strDate = strBuf1.SubString(1, Pos1-1); Label4->Caption = strDate; strBuf2 = Trim(strBuf1.SubString(Pos1+1, strBuf1.Length() - Pos1 + 1)) ; strBuf1 = strBuf2; Pos1 = Pos(',', strBuf1); strDen = strBuf1.SubString(1, Pos1+10); Label5->Caption = strDen; strBuf1 = strDate; Pos1 = Pos('=', strBuf1); strBuf2 = Trim(strBuf1.SubString(Pos1+1, strBuf1.Length() - Pos1 + 1)); Label4->Caption = strBuf2; strCom = strBuf2; strOut = strOb; OutList->Add(strOut); } Memo2->Lines = OutList; ComboBox1->Clear(); for(int i=0; i < Memo2->Lines->Count; ++i) { ComboBox1->Items->Add(Memo2->Lines->Strings[i]); } ComboBox1->ItemIndex=0; } //--------------------------------------------------------------------------- void __fastcall TForm1::ComboBox1Select(TObject *Sender) { strBuf1 = 0; Label6->Caption = ComboBox1->Items->Strings[ComboBox1->ItemIndex]; OutList->Clear(); ComboBox1->Items->Strings[ComboBox1->ItemIndex]; for (int i = 0; i < InList->Count; i++) { if (Pos(ComboBox1->Items->Strings[ComboBox1->ItemIndex],Memo1->Lines->Strings[i])){ OutList->Add(Memo1->Lines->Strings[i]) ; } } Memo2->Lines = OutList; } //--------------------------------------------------------------------------- void __fastcall TForm1::ComboBox2Select(TObject *Sender) { Label7->Caption = ComboBox2->Items->Strings[ComboBox2->ItemIndex]; OutList->Clear(); ComboBox1->Items->Strings[ComboBox1->ItemIndex]; if (ComboBox2->ItemIndex==0) { for (int i = 0; i < TempListCom->Count;i++) { ComboBox1->Items->Add(TempListCom->Strings[i]); } } if (ComboBox2->ItemIndex==1) { for (int i = 0; i < TempListOb->Count;i++) { ComboBox1->Items->Add(TempListOb->Strings[i]); } } if (ComboBox2->ItemIndex==2) { for (int i = 0; i < TempListDate->Count;i++) { ComboBox1->Items->Add(TempListDate->Strings[i]); } } } //--------------------------------------------------------------------------- Последний раз редактировалось Ольга 963; 07.12.2013 в 12:40. |
|
Похожие темы | ||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Парсер | qiperman | Работа с сетью в Delphi | 4 | 29.04.2013 22:16 |
парсер | god5 | Работа с сетью в Delphi | 10 | 29.12.2012 20:53 |
Парсер | hitrov | PHP | 0 | 04.12.2012 20:30 |
парсер на C# | newerwiner | C# (си шарп) | 1 | 08.05.2011 16:16 |
Парсер | Ronin333 | Общие вопросы C/C++ | 3 | 15.04.2010 14:00 |