i developed an application with an activation, which worked well on my system but when i installed it on my client pc it show me this error
Unhandled exception has occured in your application. if you click continue the application will ignores this error and attempt to continue if you click quit the application will close immediately.
Object reference not set to an instance of an object.
Application Code
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class dbbillz
Private Sub txtdisplaydetails_TextChanged(sender As Object, e As EventArgs) Handles txtdisplaydetails.TextChanged
If txtdisplaydetails.Text = "Enter A Name" Then
txtdisplaydetails.Text = ""
End If
End Sub
Private Sub TextBox_Validate(sender As Object, e As EventArgs) Handles txtdisplaydetails.TextChanged
If Not String.IsNullOrWhiteSpace(txtdisplaydetails.Text) Then btqmatesearch.Enabled = True
End Sub
Private Sub btqmatesearch_Click(sender As Object, e As EventArgs) Handles btqmatesearch.Click
Dim rpt As New CrystalReport2
Dim searchString As String
searchString = txtdisplaydetails.Text.Trim().ToLower()
estimatingbilldisplay.ReportSource = Nothing
If (searchString.Equals("")) Then
MessageBox.Show("Please enter some search string to print report.", "Empty value", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Return
End If
Dim DBCon As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & _
"Data Source=estimate.accdb;")
estimatingbilldisplay.Enabled = True
Dim tblDataEstimate As New DataTable
Dim tblEstimateWk As New DataTable
Dim tblClients As New DataTable
Dim cmd As New OleDbCommand()
cmd.Connection = DBCon
Dim da As New OleDbDataAdapter(cmd)
cmd.CommandText = "select * from tblClients where name='" + searchString + "'"
da.Fill(tblClients)
cmd.CommandText = "select * from tblDataEstimate where name='" + searchString + "'"
da.Fill(tblDataEstimate)
cmd.CommandText = "select * from tblEstimateWk where name='" + searchString + "'"
da.Fill(tblEstimateWk)
If (tblClients.Rows.Count = 0) Then
MessageBox.Show("No records could be found matching your search criteria, please retry with possible matcing string", "No Records Found", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return
End If
rpt.Database.Tables("tblClients").SetDataSource(tblClients)
rpt.Database.Tables("tblDataEstimate").SetDataSource(tblDataEstimate)
rpt.Database.Tables("tblEstimateWk").SetDataSource(tblEstimateWk)
estimatingbilldisplay.ReportSource = rpt
estimatingbilldisplay.Refresh()
estimatingbilldisplay.RefreshReport()
End Sub
Private Sub dbbillz_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If (Not IsApplicationActivated()) Then
Me.Enabled = False
Dim f = New frmActivation()
f.ShowDialog()
If (IsApplicationActivated()) Then
Me.Enabled = True
End If
End If
End Sub
Private Function IsApplicationActivated() As Boolean
Try
Dim Status = CryptoEngine.Decrypt(My.Settings.Activated.ToString(), SharedVars.salt)
If (Convert.ToBoolean(Status)) Then
Return True
Else
Return False
End If
Catch ex As Exception
Return False
End Try
End Function
End Class
Activation Code
Public Class frmActivation
Private Sub btnActivate_Click(sender As Object, e As EventArgs) Handles btnActivate.Click
If (Not String.IsNullOrEmpty(Me.txtKey.Text.Trim())) Then
Dim KeyCode As Long = -1
KeyCode = Long.Parse(txtKey.Text.Trim())
If (KeyCode <> -1) Then
If (Security.CheckKey(KeyCode)) Then
lblStatus.BackColor = Color.White
lblStatus.ForeColor = Color.Green
lblStatus.Text = "Application Activated."
My.Settings.Activated = CryptoEngine.Encrypt("True", SharedVars.salt)
My.Settings.Save()
Me.Close()
Else
lblStatus.BackColor = Color.White
lblStatus.ForeColor = Color.Red
lblStatus.Text = "Incorrect Activation Key, Please Try Again."
End If
Else
lblStatus.Text = "Invalid Character Entered, Please Try Again."
End If
End If
End Sub
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
End Sub
Private Sub txtKey_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtKey.KeyPress
If (Not Char.IsControl(e.KeyChar) And Not Char.IsDigit(e.KeyChar)) Then
e.Handled = True
End If
End Sub
Private Sub frmActivation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.lblCode.Text += Environment.NewLine + Security.GetSerailNo().ToString()
End Sub
End Class
What I have tried:
have tried to debug and rebuild