How to avoid double logging in a system with VisualBasic


I'm doing a system of a medical office in VisualBasic and I do not know how to make the session stay active. That is, in the Login window the RUT and the password are entered, then the BD is consulted to confirm that the data is correct. If they are correct the Login window is closed and the window corresponding to the type of user appears (In this case a doctor) Now, I do not know how to avoid a double log. How I do it so that only with the first login, the doctor has access only the orders of attention corresponding to your routine.

asked by Sagara 15.09.2016 в 19:41

2 answers


You could create a module , inside the module you create a public variable it could be Boolean and you declare it False , when the user accesses the system, you change the value of the variable to True , and change the value of the variable to False when the user has logged out ...

To avoid double logging, you compare the variable and if the value is True , then the system can not be accessed again ... But until the variable is found in False .

I hope it helps you.

answered by 01.11.2016 в 19:15

You could do it in the following ways:

  • The user adds a field that accepts 1.0 named ThisLocated. This field will be on / off as you start and close session. Here you must be very careful the app hangs, the validations to be verified intensely.

  • Create a Logins table, where you can see the user ID, the user's name, the date and time of the session start, the date and time of the end of the session. With this you verify if the user is connected by checking the last login record with the previous record if there is a logout.

answered by 15.09.2016 в 20:11