Einzelnen Beitrag anzeigen

drama22

Registriert seit: 12. Jan 2013
88 Beiträge
 
#6

AW: Delphi and Text input

  Alt 31. Okt 2014, 23:41
Delphi-Quellcode:
if Length(Trim(textinput.Text)) < 33 then
  begin
Application.MessageBox('Thats not youtube link', 'Info!', mb_iconWarning);
  end else
  if AnsiStartsStr('http://youtube.com', textinput.Text) then
  begin
   Application.MessageBox('Thats not youtube link', 'Info!', mb_iconWarning);
  end
but i got Thats not youtube link all the way cant send
Well if the string starts with http://youtube.com , why do you show the message? Show the message if it NOT starts with. Simple logic

here is full code

Delphi-Quellcode:
procedure mainform.buttonclick(Sender: TObject);
begin
  if Length(Trim(textinput.Text)) < 33 then
  begin
Application.MessageBox('invalid Youtube link', 'Info!', mb_iconWarning);
  end else
  if not AnsiStartsStr('http://youtube.com', textinput.Text) then
  begin
   Application.MessageBox('Thats not youtube link', 'Info!', mb_iconWarning);
  end else
  begin
MessageDlg('done', mtInformation, [mbOK],0);
close;
  end;
end;
but always get Thats not youtube link
  Mit Zitat antworten Zitat