Using strings in a .INI or .TXT file
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Hello Diazepa,
Yes but I mean how does a person logout?. So far the code we have been doing tells us when the user has logged in and takes a picture of them and stuff like that. How is a person going to logout?, will they have to enter the ID number again as they leave?.
Thank you.
Yes but I mean how does a person logout?. So far the code we have been doing tells us when the user has logged in and takes a picture of them and stuff like that. How is a person going to logout?, will they have to enter the ID number again as they leave?.
Thank you.
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Precicely
Same action as logging in, but only difference is that the log tells that the person logged out:)
Same action as logging in, but only difference is that the log tells that the person logged out:)
Hello Diazepa,
A quick cheap way of doing this would be to create a file with the users ID when they first login. The code below is the "TextBox1_TextChanged" event code that ive changed. It includes the webcam image saver and email code aswell so you may need to go through it and make a couple of small changes.
The new code:
Its a cheap way of doing it but effective all the same.
Hope that helps cooll;
A quick cheap way of doing this would be to create a file with the users ID when they first login. The code below is the "TextBox1_TextChanged" event code that ive changed. It includes the webcam image saver and email code aswell so you may need to go through it and make a couple of small changes.
The new code:
Code: Select all
In this code all I added was this:Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
Dim data As IDataObject
Dim bmap As Image
If TextBox1.Text.Length = "4" Then
GetUsersName = ""
Dim lines() As String = File.ReadAllLines("C:\Konf Reg\Konf Medlemmer.ini")
Dim IDfinder As String = TextBox1.Text
For Each line As String In lines
If line.IndexOf(IDfinder) <> -1 Then
FindIDOfUser = line
GetUsersName = FindIDOfUser.Split("="c)(0)
'/////////////// NEW CODE /////////////////
If My.Computer.FileSystem.FileExists("C:\" + FindIDOfUser.Split("="c)(1) + ".lio") Then
Form3.TextBox1.Text = TextBox1.Text + vbNewLine + GetUsersName + " Logged Out at: " + Label1.Text + "!"
My.Computer.FileSystem.DeleteFile("C:\" + FindIDOfUser.Split("="c)(1) + ".lio", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
Else
My.Computer.FileSystem.WriteAllText("C:\" + FindIDOfUser.Split("="c)(1) + ".lio", "Logged In", False)
'/////////////////END NEW CODE//////////
SendMessage(hWnd, WM_CAP_EDIT_COPY, 640, 480)
data = Clipboard.GetDataObject()
If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Image)
PictureBox1.Image = bmap
bmap.Save("C:\" + GetUsersName + ".jpg", Imaging.ImageFormat.Jpeg)
End If
Form3.TextBox1.Text = TextBox1.Text + vbNewLine + GetUsersName + " Logged In at: " + Label1.Text + "!"
Dim from As New MailAddress("Youremail@address.com") 'Change
Dim [to] As New MailAddress("Youremail@address.com") 'Change
Dim theMailMessage As New MailMessage(from, [to])
theMailMessage.Body = GetUsersName + "Has just logged in!"
theMailMessage.Attachments.Add(New Attachment("C:\" + GetUsersName + ".jpg"))
theMailMessage.Subject = "New logged in"
Dim theClient As New SmtpClient("youremail.server.com) ' Change
theClient.UseDefaultCredentials = False
Dim theCredential As New System.Net.NetworkCredential("USERNAME", "PASSWORD") 'Change
theClient.Credentials = theCredential
theClient.EnableSsl = True
Try
theClient.Send(theMailMessage)
Catch wex As Net.WebException
MessageBox.Show("Could not send email...check your settings.")
End Try
MsgBox("E-mail successfully sent !")
End If
End If
Next
If GetUsersName = "" Then
MsgBox("Unregistered", MsgBoxStyle.Critical, "Ops! Uregistrert nummer!")
End If
End If
End Sub
Code: Select all
What this code does is when a user entered there ID into the system it will check if they are logging in or logging out. If they are logging in it will take a photo and send it via email as normal and save "User has logged in" to the log file. It will also create a file using there userID and save it onto the system. The when the user enters there userID again (to say they are logging out) it will check to see if a file exists on the system with there userID number and if it does then it will erase the file and save "User has logged out" to the log and skip the image taking and email part. If that makes sense?If My.Computer.FileSystem.FileExists("C:\" + FindIDOfUser.Split("="c)(1) + ".lio") Then
Form3.TextBox1.Text = TextBox1.Text + vbNewLine + GetUsersName + " Logged Out at: " + Label1.Text + "!"
My.Computer.FileSystem.DeleteFile("C:\" + FindIDOfUser.Split("="c)(1) + ".lio", FileIO.UIOption.OnlyErrorDialogs, FileIO.RecycleOption.DeletePermanently)
Else
My.Computer.FileSystem.WriteAllText("C:\" + FindIDOfUser.Split("="c)(1) + ".lio", "Logged In", False)
Its a cheap way of doing it but effective all the same.
Hope that helps cooll;
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Uhm :P Not to be picky, but the cam wont choose open itself - it just focuses/mark it in the listbox :P
Great work
Great work
Hello,
Oh yes change your "ListBox1_SelectedIndexChanged" event to this:
Oh yes change your "ListBox1_SelectedIndexChanged" event to this:
Code: Select all
That should do it cooll;Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
CamSource = ListBox1.SelectedIndex
previewCamera(PictureBox1)
End Sub
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
Thanks it has a few errors but, ill sort those out myself
Thanks ^^,
Thanks ^^,
Copyright Information
Copyright © Codenstuff.com 2020 - 2023