Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27569

No source code for the current location

$
0
0
Hi,

I am in the middle of creating an ATM programme using VB 2008 Express Edition. I am having issues with my code and getting 2 errors, the first is "No source code for the current location" when I click OK, I get the follow error:

"NullReferenceException was unhandled - Object Reference not set to an instance of an object"


I have highlighted below in purple and bold text, this is where I am getting an error message. The source code was working for me but all of a sudden it stopped...

Option Strict On

Public Class Enter_Pin

''Declaring Variables
Dim inc As Integer
Dim con As New OleDb.OleDbConnection
Dim dbProvider As String
Dim dbSource As String
Dim ds As New DataSet
Dim da As New OleDb.OleDbDataAdapter
Dim sql As String
Dim maxrows As Integer

Private Sub cmdEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdEnter.Click

''entering Pin submission
Dim searchID As String
Dim i, CurrentRow As Integer
searchID = txtPin.Text
i = 0
While i <> maxrows + 1

If searchID = ds.Tables("AddressBook").Rows(i)("Pin") Then
Me.Close()
Customer_Menu.Show()
ElseIf i = maxrows Then
MsgBox("Invalid Pin Number")
Exit While
End If
i += 1
End While
CurrentRow = i
End Sub

Private Sub Enter_Pin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
''Searching the database to find the correct pin number / database connection
dbProvider = "Provider=Microsoft.Jet.4.0;"
dbSource = "Data Source = C:\Database\AddressBook.mdb;"
con.ConnectionString = dbProvider & dbSource
con.Open()
sql = "SELECT * FROM AddressBook"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "AddressBook")
maxrows = ds.Tables("AddressBook").Rows.Count

End Sub

Private Sub cmdOne_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdOne.Click, cmdTwo.Click, cmdThree.Click, cmdFour.Click, cmdFive.Click, cmdSix.Click, cmdSeven.Click, cmdEight.Click, cmdNine.Click, cmdZero.Click
''clicking on the pin number buttons
txtPin.Text = txtPin.Text & sender.text
End Sub

Private Sub cmdClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClear.Click
''pin clears from the textbox
txtPin.Text = ""
End Sub

Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
''if cancel clicked on, taken back to Welcome Screen
Welcome_Screen.Show()
Me.Close()
End Sub

End Class

Any help with this would be appreciated.

Thanks

Mary

Viewing all articles
Browse latest Browse all 27569

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>