I would like to put 'user name' and 'password' before executing my project, but I really don't know how to do it.
Could anyone give me a guide line to do this?

Best Regards,

if you already know how to use a VB with database then add a form and select a log-in form... there's a guide code there...





Actually, I am not sure which methods, DataBase or Fiel, is better to save old datas, username and password. Do you know which one is easier?


[TEX]where do u plan to store the username and password ?[/TEX]

I really don't want user to find out the part that store username and password. I saw some use registry or other directory. Where should I save them for safety.

Best Regards,

don't save to registry. its not good, will make your system unstable if you did not careful.

Hi Jx_man,

Thanks. I will use '.dat' or '.txt' file to save the data.


why .dat or .txt file?

whats wrong in storing the login info in database?

after all they are sensitive info and storing them in a normal file in textual format can lead other users to easily view or modify them.

even storing the passwords in registry can be a good option. just make sure that you have taken sufficient caution before making your move to play with your os.

Hello choudhuryshouvi,

It is corrected. If we save the data with textual format, the user can be easily modify them. I said I will store the data in '.dat' or '.txt' file because I have two sample programs that they all are put the data in that file.
Another thing is I am not familiar with OS. If so, I don't know how to use the registry. Do you have a sample code written in Registry?

Best Regards,

hello zawpai......look in the attachment.
there is a code for you showing how to read and write using windows registry.

when you run the code the login form opens and it will ask you to enter new username & password. enter those and click save. next time you run the program you can login using the previously stored info. well this is just a sample snippet. this is not all. this code can be made more advanced and secure based on program requirement.

check this out and give me your feedback. if you got any questions ask me here.


Hi choudhuryshouvi,

Thank you for giving a sample code. I understand well and know where the data are saved.

Best Regards,

HKEY_Current_User\Software\VB and VBA Program Settings.
open regedit and go to above path to see the result by shouvik code...

hello zawpai.......
have you benefited from the code i gave you?
is this what you wanted?
has it solved your problem?
did you get your answer?

if your answer to all the questions is YES then mark this thread as SOLVED.

well.......if you still want any more help just do not hesitate.....post right here..


hi choudhuryshouvi,

I get the answer what i want.

Thanks a lot,

This question has already been answered. Start a new discussion instead.