Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, DB, DBTables, StdCtrls, Grids, DBGrids;
- type
- TForm1 = class(TForm)
- Edit1: TEdit;
- ComboBox1: TComboBox;
- Button1: TButton;
- ListBox1: TListBox;
- kon: TTable;
- rez: TTable;
- ComboBox2: TComboBox;
- DBGrid1: TDBGrid;
- DataSource1: TDataSource;
- DataSource2: TDataSource;
- procedure Button1Click(Sender: TObject);
- procedure ComboBox1Change(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- listbox1.Clear;
- // za rezistori
- if combobox1.Text = 'Резистори'
- then begin
- // ------------------------
- if combobox2.text = 'Номинал'
- then begin
- while not rez.eof do
- begin
- if rez.fieldvalues['Nominal']=edit1.text
- then listbox1.items.add(Floattostr(rez.fieldvalues['IDR'])+#9+rez.fieldvalues['Nominal']+#9+rez.fieldvalues['Tip']+#9+Floattostr(rez.fieldvalues['Moshnost']));
- rez.next;
- end;
- end;
- // ---------------
- if combobox2.text = 'Тип'
- then begin
- while not rez.eof do
- begin
- if rez.fieldvalues['Tip']=edit1.text
- then listbox1.items.add(Floattostr(rez.fieldvalues['IDR'])+#9+rez.fieldvalues['Nominal']+#9+rez.fieldvalues['Tip']+#9+floattostr(rez.fieldvalues['Moshnost']));
- rez.next;
- end;
- end;
- // ------------------
- if combobox2.text = 'Мощност'
- then begin
- while not rez.eof do
- begin
- if rez.fieldvalues['Moshnost']=edit1.text
- then listbox1.items.add(Floattostr(rez.fieldvalues['IDR'])+#9+rez.fieldvalues['Nominal']+#9+rez.fieldvalues['Tip']+#9+floattostr(rez.fieldvalues['Moshnost']));
- rez.next;
- end;
- end;
- end;
- // за кондензатори
- if combobox1.Text = 'Кондензатори'
- then begin
- // ------------------------
- if combobox2.text = 'Номинал'
- then begin
- while not rez.eof do
- begin
- if kon.fieldvalues['Nominal']=edit1.text
- then listbox1.items.add(Floattostr(kon.fieldvalues['IDC'])+#9+kon.fieldvalues['Nominal']+#9+kon.fieldvalues['Tip']+#9+floattostr(kon.fieldvalues['Moshnost']));
- kon.next;
- end;
- end;
- // ---------------
- if combobox2.text = 'Тип'
- then begin
- while not rez.eof do
- begin
- if kon.fieldvalues['Tip']=edit1.text
- then listbox1.items.add(Floattostr(kon.fieldvalues['IDC'])+#9+kon.fieldvalues['Nominal']+#9+kon.fieldvalues['Tip']+#9+floattostr(kon.fieldvalues['Naprejenie']));
- kon.next;
- end;
- end;
- // ------------------
- if combobox2.text = 'Напрежение'
- then begin
- while not rez.eof do
- begin
- if kon.fieldvalues['Мощност']=edit1.text
- then listbox1.items.add(Floattostr(kon.fieldvalues['IDC'])+#9+kon.fieldvalues['Nominal']+#9+kon.fieldvalues['Tip']+#9+floattostr(kon.fieldvalues['Naprejenie']));
- kon.next;
- end;
- end;
- end;
- end;
- procedure TForm1.ComboBox1Change(Sender: TObject);
- begin
- combobox2.clear;
- if combobox1.Text = 'Резистори'
- then begin
- combobox2.items.add('Номинал');
- combobox2.items.add('Тип');
- combobox2.items.add('Мощност');
- end;
- if combobox1.Text = 'Кондензатори'
- then begin
- combobox2.items.add('Номинал');
- combobox2.items.add('Тип');
- combobox2.items.add('Напрежение');
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement