This form recovers user password via email.
can someone tell me why am I getting this error and how should I fix it?
![Name: error.JPG
Views: 89
Size: 185.0 KB]()
can someone tell me why am I getting this error and how should I fix it?
Code:
Imports System.Net.Mail
Imports System.Data.OleDb
Imports System.Runtime.InteropServices
Imports System.ComponentModel
Imports System.Windows.Forms.VisualStyles
Public Class frmPassword_Recovery
Private Sub AeroForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'<AeroNeed>
'This call is required by Fix soft Fix_soft_Aero_Form1.
'If you delete it,Aero doesn't work.
RealBackGroundImage = Me.BackgroundImage
ResetAeroGlass()
If AutoShowLabels Then
For Each Control In Controls
If TypeOf Control Is Label Then
ShowLabel(Control)
End If
Next
End If
'</AeroNeed>
Me.Hide()
Login_Form.Show()
Login_Form.txtUsername.Text = ""
Login_Form.txtPassword.Text = ""
Login_Form.txtUsername.Focus()
End Sub
Private Sub KryptonButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton1.Click
Try
Cursor = Cursors.WaitCursor
Timer1.Enabled = True
Dim ds As New DataSet()
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Username_Password.accdb")
con.Open()
Dim cmd As New OleDbCommand("SELECT Password FROM Username_Password WHERE User_Type = 'Administrator'", con)
Dim da As New oledbDataAdapter(cmd)
da.Fill(ds)
con.Close()
If ds.Tables(0).Rows.Count > 0 Then
Dim Msg As New MailMessage()
' Sender e-mail address.
Msg.From = New MailAddress("ashveen96@yahoo.com")
' Recipient e-mail address.
Msg.[To].Add("ashveen1996@gmail.com")
Msg.Subject = "Your Password Details"
Msg.Body = "Your Password: " & Convert.ToString(ds.Tables(0).Rows(0)("Password")) & ""
Msg.IsBodyHtml = True
' your remote SMTP server IP.
Dim smtp As New SmtpClient()
smtp.Host = "smtp.mail.yahoo.com"
smtp.Port = 465
smtp.Credentials = New System.Net.NetworkCredential("ashveen96@yahoo.com", "abcd123")
smtp.EnableSsl = True
smtp.Send(Msg)
MessageBox.Show("Password Successfully sent " & vbCrLf & "Please check your mail", "Thank you", MessageBoxButtons.OK, MessageBoxIcon.Information)
Me.Hide()
Login_Form.Show()
Login_Form.txtUsername.Text = ""
Login_Form.txtPassword.Text = ""
Login_Form.txtUsername.Focus()
End If
Catch ex As Exception
MsgBox(ex.ToString())
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Cursor = Cursors.Default
Timer1.Enabled = False
End Sub
End Class