Показать сообщение отдельно
  #2  
Старый 05.04.2012, 10:50
Аватар для NumLock
NumLock NumLock вне форума
Let Me Show You
 
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
По умолчанию

Код:
type
  TForm1 = class(TForm)
    ComboBox1: TComboBox;
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
...
function Check(const User, Pass: String): Boolean;
begin
  Result:=True;
  if (User='админ') and (Pass='sysop') then Exit
  else if (User='секретарь') and (Pass='masha') then Exit
  else if (User='бухгалтер') and (Pass='nomoney') then Exit
  else if (User='итд') and (Pass='anykey') then Exit
  else Result:=False;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if not Check(ComboBox1.Text, Edit1.Text) then ShowMessage('Oops')
  else Form2.ShowModal;
end;

Код:
  object ComboBox1: TComboBox
    Left = 176
    Top = 96
    Width = 145
    Height = 21
    Style = csDropDownList
    ItemHeight = 13
    ItemIndex = 0
    TabOrder = 0
    Text = 'админ'
    Items.Strings = (
      'админ'
      'секретарь'
      'бухгалтер'
      'итд')
  end
__________________
Пишу программы за еду.
__________________
Ответить с цитированием