-
Dec 19th, 2015, 04:38 PM
#1
Thread Starter
Frenzied Member
[RESOLVED] How to set user permissions from program
Alright so I realized something I would like to change. How can I show the admin settings forms only if the computer user account is Admin otherwise those settings or even the buttons aren't shown but are active as the admin sets them?
-
Dec 19th, 2015, 05:47 PM
#2
Thread Starter
Frenzied Member
Re: How to set user permissions from program
Fixed. I just add a login screen and if the username and password belongs to the textfiles that contain the admin username and passwords then the settings button is visible otherwise it isn't and the user name and password is filtered through the regular user text files (one for password and one for username Basically if user and pass match of the reg user crediental files then user permssions set and if admin admin is set)
If you would like me to post code I certainly can
-
Dec 20th, 2015, 08:02 AM
#3
Re: [RESOLVED] How to set user permissions from program
I marked this thread as Resolved since you obviously solved it in a manner that you're happy with.
-
Dec 20th, 2015, 08:15 AM
#4
Thread Starter
Frenzied Member
My Easy Login Basic
So I finally discovered a easy way, to create a login without using databases or anything other than a couple of text files.
First things first create your project and add a login form, the way I do it is on load the form1 isn't visible until you login I am sure there is a better way but that is the way it works for me anyways once you have the login form add two text files name one Username and the other Password.
Then go to your project settings and add two for the first name it username and second one name it password set the value for the username as
And for the password setting as this:
Now when the user enters the username and password and clicks ok this happens
Code:
For Each username As String In File.ReadLines(My.Application.Info.DirectoryPath & "\" & My.Settings.Username)
For Each password As String In File.ReadLines(My.Application.Info.DirectoryPath & "\" & My.Settings.Password)
If UsernameTextBox.Text = username And PasswordTextBox.Text = password Then
form1.Visible = True
Me.Visible = False
UsernameTextBox.Enabled = False
PasswordTextBox.Enabled = False
else
msgbox("Incorrect login)
end if
next
next
I added some more custom stuff so if it is error shows retry option but that is causing a problem so don't wanna plague you with code that doesnt work lol.
And dont forget to hide your form1 as
Code:
on load add this: me.visible = false
Hope this helps someone!
-
Dec 20th, 2015, 08:24 AM
#5
Thread Starter
Frenzied Member
Re: My Easy Login Basic
Oh and one last thing only reason i am posting this is because I asked about a basic login a while ago and just stumpled onto this myself and thought i would share it I use the same for each line idea for my filter part of my browser and thought well if it is trying to match it then maybe i can use it for a login too
-
Dec 20th, 2015, 10:53 AM
#6
Re: [RESOLVED] How to set user permissions from program
New thread merged with the old.
-
Dec 20th, 2015, 12:46 PM
#7
Thread Starter
Frenzied Member
Re: [RESOLVED] How to set user permissions from program
Originally Posted by Joacim Andersson
New thread merged with the old.
There was a thread older than this i had asked about a login.
-
Dec 20th, 2015, 01:20 PM
#8
Re: [RESOLVED] How to set user permissions from program
OK, but it also fits here since you've solved the other issue related to this here. I just didn't think it required its own thread with some explanation without any kind of context, that's why I merged the threads.
-
Dec 20th, 2015, 01:26 PM
#9
Re: [RESOLVED] How to set user permissions from program
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|