Advertisement
Guest User

Untitled

a guest
Mar 12th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 3.79 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, DB, DBTables, StdCtrls, Grids, DBGrids;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Edit1: TEdit;
  12.     ComboBox1: TComboBox;
  13.     Button1: TButton;
  14.     ListBox1: TListBox;
  15.     kon: TTable;
  16.     rez: TTable;
  17.     ComboBox2: TComboBox;
  18.     DBGrid1: TDBGrid;
  19.     DataSource1: TDataSource;
  20.     DataSource2: TDataSource;
  21.     procedure Button1Click(Sender: TObject);
  22.     procedure ComboBox1Change(Sender: TObject);
  23.   private
  24.     { Private declarations }
  25.   public
  26.     { Public declarations }
  27.   end;
  28.  
  29. var
  30.   Form1: TForm1;
  31.  
  32. implementation
  33.  
  34. {$R *.dfm}
  35.  
  36. procedure TForm1.Button1Click(Sender: TObject);
  37. begin
  38.   listbox1.Clear;
  39.   // za rezistori
  40.   if combobox1.Text = 'Резистори'
  41.   then begin
  42.     // ------------------------
  43.     if combobox2.text = 'Номинал'
  44.     then begin
  45.       while not rez.eof do
  46.       begin
  47.         if rez.fieldvalues['Nominal']=edit1.text
  48.           then listbox1.items.add(Floattostr(rez.fieldvalues['IDR'])+#9+rez.fieldvalues['Nominal']+#9+rez.fieldvalues['Tip']+#9+Floattostr(rez.fieldvalues['Moshnost']));
  49.                rez.next;
  50.           end;
  51.     end;
  52.  
  53.     // ---------------
  54.     if combobox2.text = 'Тип'
  55.     then begin
  56.       while not rez.eof do
  57.       begin
  58.         if rez.fieldvalues['Tip']=edit1.text
  59.           then listbox1.items.add(Floattostr(rez.fieldvalues['IDR'])+#9+rez.fieldvalues['Nominal']+#9+rez.fieldvalues['Tip']+#9+floattostr(rez.fieldvalues['Moshnost']));
  60.         rez.next;
  61.           end;
  62.     end;
  63.  
  64.     // ------------------
  65.     if combobox2.text = 'Мощност'
  66.     then begin
  67.       while not rez.eof do
  68.       begin
  69.         if rez.fieldvalues['Moshnost']=edit1.text
  70.           then listbox1.items.add(Floattostr(rez.fieldvalues['IDR'])+#9+rez.fieldvalues['Nominal']+#9+rez.fieldvalues['Tip']+#9+floattostr(rez.fieldvalues['Moshnost']));
  71.                rez.next;
  72.           end;
  73.     end;
  74.   end;
  75.  
  76.  
  77.   // за кондензатори
  78.   if combobox1.Text = 'Кондензатори'
  79.   then begin
  80.     // ------------------------
  81.     if combobox2.text = 'Номинал'
  82.     then begin
  83.       while not rez.eof do
  84.       begin
  85.         if kon.fieldvalues['Nominal']=edit1.text
  86.           then listbox1.items.add(Floattostr(kon.fieldvalues['IDC'])+#9+kon.fieldvalues['Nominal']+#9+kon.fieldvalues['Tip']+#9+floattostr(kon.fieldvalues['Moshnost']));
  87.                kon.next;
  88.           end;
  89.     end;
  90.  
  91.     // ---------------
  92.     if combobox2.text = 'Тип'
  93.     then begin
  94.       while not rez.eof do
  95.       begin
  96.         if kon.fieldvalues['Tip']=edit1.text
  97.           then listbox1.items.add(Floattostr(kon.fieldvalues['IDC'])+#9+kon.fieldvalues['Nominal']+#9+kon.fieldvalues['Tip']+#9+floattostr(kon.fieldvalues['Naprejenie']));
  98.                kon.next;
  99.           end;
  100.     end;
  101.  
  102.     // ------------------
  103.     if combobox2.text = 'Напрежение'
  104.     then begin
  105.       while not rez.eof do
  106.       begin
  107.         if kon.fieldvalues['Мощност']=edit1.text
  108.           then listbox1.items.add(Floattostr(kon.fieldvalues['IDC'])+#9+kon.fieldvalues['Nominal']+#9+kon.fieldvalues['Tip']+#9+floattostr(kon.fieldvalues['Naprejenie']));
  109.                kon.next;
  110.           end;
  111.       end;
  112.   end;
  113.  
  114. end;
  115.  
  116. procedure TForm1.ComboBox1Change(Sender: TObject);
  117. begin
  118.  
  119.   combobox2.clear;
  120.  
  121.   if combobox1.Text = 'Резистори'
  122.     then begin
  123.        combobox2.items.add('Номинал');
  124.        combobox2.items.add('Тип');
  125.        combobox2.items.add('Мощност');
  126.     end;
  127.  
  128.   if combobox1.Text = 'Кондензатори'
  129.     then begin
  130.        combobox2.items.add('Номинал');
  131.        combobox2.items.add('Тип');
  132.        combobox2.items.add('Напрежение');
  133.     end;
  134. end;
  135.  
  136. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement