Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Chamar evento
- this->tbCodBar->TextChanged += gcnew System::EventHandler(this, &Prods::tb_TextChanged);
- this->tbCat->TextChanged += gcnew System::EventHandler(this, &Prods::tb_TextChanged);
- this->tbFab->TextChanged += gcnew System::EventHandler(this, &Prods::tb_TextChanged);
- this->tbNome->TextChanged += gcnew System::EventHandler(this, &Prods::tb_TextChanged);
- //Função de atualizar a listbox (ou listview???? bolas enganeime lol) lvProds
- void AtualizarListBox(string cat, string nome, string cb, string fab)
- {
- this->UseWaitCursor = true;
- lvProds->Items->Clear();
- Lista<produto> *lp;
- produto *p;
- int x=0;
- for(int i=0; i<LC.NElem(); i++)
- {
- if(cat!="" && CoisasUteis::SToUpper(LC[i]->GetNomeCat()).find(CoisasUteis::SToUpper(cat)) == string::npos) //se a categoria nao for nula e nao estiver contida nesta categoria continuar
- continue;
- lp=LC[i]->GetLP();
- for(int n=0; n<lp->NElem();n++)
- {
- if((nome!="" && CoisasUteis::SToUpper(lp->GetInfo(n)->GetNome()).find(CoisasUteis::SToUpper(nome)) == string::npos) ||
- (cb!="" && CoisasUteis::SToUpper(lp->GetInfo(n)->GetCodBar()).find(CoisasUteis::SToUpper(cb)) == string::npos) ||
- (fab!="" && CoisasUteis::SToUpper(lp->GetInfo(n)->GetFab()).find(CoisasUteis::SToUpper(fab)) == string::npos))
- continue;
- p=lp->GetInfo(n);
- ListViewItem^ Item = gcnew ListViewItem(CoisasUteis::ConverterstringToString(LC[i]->GetNomeCat()));
- Item->SubItems->Add(CoisasUteis::ConverterstringToString(p->GetNome()));
- Item->SubItems->Add(CoisasUteis::ConverterstringToString(p->GetCodBar()));
- Item->SubItems->Add(p->GetQt().ToString());
- Item->SubItems->Add(p->GetPreco().ToString());
- Item->SubItems->Add(CoisasUteis::ConverterstringToString(p->GetDataF()));
- Item->SubItems->Add(CoisasUteis::ConverterstringToString(p->GetDataV()));
- Item->SubItems->Add(CoisasUteis::ConverterstringToString(p->GetFab()));
- Item->SubItems->Add(CoisasUteis::ConverterstringToString(p->GetLoc()));
- lvProds->Items->Add(Item);
- }
- }
- this->UseWaitCursor = false;
- }
- //Evento
- private: System::Void tb_TextChanged(System::Object^ sender, System::EventArgs^ e)
- {
- AtualizarListBox(CoisasUteis::ConverterStringTostring(tbCat->Text),CoisasUteis::ConverterStringTostring(tbNome->Text),CoisasUteis::ConverterStringTostring(tbCodBar->Text),CoisasUteis::ConverterStringTostring(tbFab->Text));
- }
Advertisement
Add Comment
Please, Sign In to add comment