Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure TfrmMain.btnGenerateClick(Sender: TObject);
- var
- iSpacePos: integer;
- sFullName, sFirstInit, sSecondInit, sYear, sEmail: string;
- begin
- sFullName := edtFullName.Text;
- iSpacePos := pos(' ', sFullName);
- sFirstInit := AnsiLowerCase(copy(sFullName, 1, 3));
- sSecondInit := AnsiLowerCase(copy(sFullName, iSpacePos + 1, 3));
- sYear := copy(edtYear.Text, 3, 4);
- //sYear := copy(IntToStr(sedYear.Value), 3, 4); // if using the spin edit component instead of the edit box
- sEmail := 'Email Address: ' + sFirstInit + sSecondInit + sYear +
- '@northwoodschool.co.za';
- lblEmailAddress.Caption := sEmail;
- // for debugging
- //lblEmailAddress.Caption := IntToStr(iSpacePos);
- //lblEmailAddress.Caption := sSecondInit;
- end;
- procedure TfrmMain.FormCreate(Sender: TObject);
- begin
- frmMain.Caption := 'EAGen';
- lblNameMessage.Caption := 'Enter your full name';
- lblYear.Caption := 'Enter your matric year';
- edtYear.Text := '2024';
- edtFullName.Text := '';
- btnGenerate.Caption := 'Generate';
- lblEmailAddress.Caption := '';
- pnlHeading.Caption := 'Email Address Generator';
- pnlHeading.Font.Style := [fsBold];
- //sedYear.Value := 2024;
- //sedYear.MaxValue := 2030;
- //sedYear.MinValue := 2022;
- end;
Advertisement