Hi everyone,

I'm making yet another program, and i am needing a login screen. The first form has 2 edit boxes and 2 buttons. The cancel button closes the program, the login button checks the username password if there correct or not. I have written the code for the login button but an error message keeps apearing every time I click the login button. The code that i have user is as follows:

begin
If edit1.Text='Admin' Then
Begin
Edit1.Readonly:=true;
end
else
If edit2.Text='1234' Then
Begin
form2.Visible:=True;
end
else
Begin
ShowMessage('Incorrect username and password');
end;

Could someone please help me out.

What is the error cos the above code is ok

if enters Admin sets the editbox to readonly
if enters 1234 shows form2

if neither above are true then shows 'Incorrect username and password'

I've figured it out now.
Thank you for ur help.

Just a quick question, How would I encrypted the username and password?

I've figured it out now.
Thank you for ur help.

Just a quick question, How would I encrypted the username and password?

how did you do it in your login screen?? that's also one of my problem.. I'm doing a system that has a login screen and if the privilege is student then it will open immediately the student forms which can only view the information. Thus, if the privilege is physician then it can add, edit and view the information. But, still, I don't know how to do it..

I've figured it out now.
Thank you for ur help.

Just a quick question, How would I encrypted the username and password?

how did you do it in your login screen?? that's also one of my problem.. I'm doing a system that has a login screen and if the privilege is student then it will open immediately the student forms which can only view the information. Thus, if the privilege is physician then it can add, edit and view the information. But, still, I don't know how to do it..

I'm guessing you were getting an access violation error, which usually means you are trying to access properties of an object that has not yet been created. Has form2 been created already but has been hidden or visible:=false?

For encryptions, depends on how secure you need it to be. Some easy things you can do is:

1. Add an offset to each character, like "M" is an ASCII 77, so replace it with ASCII 127, for example. Similarly, you could do all sort of character-by-character operations, like vary the offset according to the position in the string, or make other bit-level changes.

2. Jumble the letters

3. Mix the string in with another long and randomly generated string.

4. Use a public-key type routine. The math is easy, but to be effective you have to use some big numbers.

how did you do it in your login screen?? that's also one of my problem.. I'm doing a system that has a login screen and if the privilege is student then it will open immediately the student forms which can only view the information. Thus, if the privilege is physician then it can add, edit and view the information. But, still, I don't know how to do it..

do you know who to change the dbgrid menutitle?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.