Advertisement
szarlotkas

Dodawanie do bazy

Nov 23rd, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 2.10 KB | None | 0 0
  1. procedure TForm1.ButtonZatwierdzClick(Sender: TObject);
  2. begin
  3.     If (ComboBoxNazwa.Text='') OR (ComboBoxKraj.Text='') OR (ComboBoxTemperatura.Text='') OR (EditIlosc.Text='') OR (EditCena.Text='') OR (EditDostawca.Text='') OR (EditOdbiorca.Text='') then begin ShowMessage('Musisz podac wszystkie dane!'); exit; end;
  4.  
  5.       if Tabela.Cells[0, Tabela.RowCount-1] <> '' then  Tabela.RowCount:=Tabela.RowCount+1;    //zwiekszanie ilosci wierszy
  6.  
  7.       Tabela.Cells[0,Tabela.RowCount-1] := IntToStr(Tabela.RowCount-1);
  8.  
  9.       Tabela.Cells[1,Tabela.RowCount-1] := ComboBoxNazwa.Text;
  10.  
  11.       Tabela.Cells[2,Tabela.RowCount-1] := ComboBoxKraj.Text;
  12.  
  13.       Tabela.Cells[3,Tabela.RowCount-1] := EditIlosc.Text;
  14.       Tabela.Cells[4,Tabela.RowCount-1] := EditCena.Text;
  15.       Tabela.Cells[5,Tabela.RowCount-1] := IntToStr(StrToInt(EditCena.Text)*StrToInt(EditIlosc.Text));
  16.       Tabela.Cells[6,Tabela.RowCount-1] := ComboBoxTemperatura.Text;
  17.       if (CheckBoxMrozenie.Checked = true) then Tabela.Cells[7,Tabela.RowCount-1]:='TAK' else Tabela.Cells[7,Tabela.RowCount-1] := 'NIE';
  18.       Tabela.Cells[8,Tabela.RowCount-1] := EditDostawca.Text;
  19.       Tabela.Cells[9,Tabela.RowCount-1] := EditOdbiorca.Text;
  20.  
  21.  
  22.  
  23.     ComboBoxNazwa.ClearSelection;
  24.     ComboBoxKraj.ClearSelection;
  25.     EditIlosc.Text := '';
  26.     EditCena.Text := '';
  27.     ComboBoxTemperatura.ClearSelection;
  28.     CheckBoxMrozenie.Checked := false;
  29.     EditDostawca.Text := '';
  30.     EditOdbiorca.Text := '';
  31.  
  32.  
  33.     LabelNazwa.Enabled := false; ComboBoxNazwa.Enabled := false;
  34.     LabelKraj.Enabled := false; ComboBoxKraj.Enabled := false;
  35.     LabelIlosc.Enabled := false; EditIlosc.Enabled := false;
  36.     LabelCena.Enabled := false; EditCena.Enabled := false;
  37.     LabelTemperatura.Enabled := false; ComboBoxTemperatura.Enabled := false;
  38.     CheckBoxMrozenie.Enabled := false;
  39.     LabelDostawca.Enabled := false; EditDostawca.Enabled := false;
  40.     LabelOdbiorca.Enabled := false; EditOdbiorca.Enabled := false;
  41.  
  42.     ButtonZatwierdz.Enabled := false;
  43.     ButtonUsun.Enabled := true;
  44.     ButtonZapisz.Enabled := true;
  45.     ButtonWczytaj.Enabled := true;
  46.  
  47.  
  48. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement