Use the "new" keyword to create an object instance
Check to determine of the object is null before calling the method
i'm really starting to loose my patience with this error, i've searched and searched but somehow i can't can't find the right ones. >.<
will someone pleaaaseee~ please help me~
here is the code where the problem occurs, and the error points at the line that is Underlined.
thank you in advance~

Check to determine of the object is null before calling the method
i'm really starting to loose my patience with this error, i've searched and searched but somehow i can't can't find the right ones. >.<
will someone pleaaaseee~ please help me~
here is the code where the problem occurs, and the error points at the line that is Underlined.
VB.NET:
Private Sub Save(ByVal Mode As String)
If Mode = "Borrow" Then
ans = MessageBox.Show("Are you sure you want to borrow the book?", "Important Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If ans = Windows.Forms.DialogResult.Yes Then
strQry = "SELECT bookID,status FROM rc_book WHERE bookID = '" & Me.MaskedTextBox1.Text & "'"
[U][B] DTable = dl.CreateDataTableFromQry(strQry)[/B][/U]
If DTable.Rows.Count <> 0 Then
For Each dRow As DataRow In DTable.Rows
strbookID = dRow("bookID")
strstatus = dRow("status")
If strbookID = Me.MaskedTextBox1.Text Then
strstatus = dRow("status")
If strstatus = "Unavailable" Then
MessageBox.Show("The book is unavailable")
ElseIf strstatus = "Lost" Then
MessageBox.Show("The book is lost")
ElseIf strstatus = "Damaged" Then
MessageBox.Show("The book is damaged")
Else
cmd = New MySqlCommand("INSERT INTO rc_borrow(bookID,title,status,studid,firstname,lastname,dateborrowed,datereturned,daystoborrow) VALUES ('" & strbookID & "','" & strtitle & "', '" & strstatus & "', '" & strid & "', '" & strfname & "', '" & strlname & "', '" & strdateborrow & "', '" & strdatereturn & "','" & strdays & "')", con)
If con.State = ConnectionState.Closed Then con.Open()
dr = cmd.ExecuteReader
MessageBox.Show("Record has been saved!")
con.Close()
Me.DataGridView1.Update()
End If
End If
Next
End If
End If
End If
Me.DataGridView1.Refresh()
End Sub
thank you in advance~