I am currently developing a bio-metric application and everything seems to work well until it gets to the code snippet below. The variable fs generates an error "Object reference not set to an instance of an object"
Try
Using fs As FileStream = IO.File.Open(lblPath.Text + "/" + txtFoundationNo.Text + ".fpt", IO.FileMode.OpenOrCreate, IO.FileAccess.Write)
Template.Serialize(fs)
End Using
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Enrollment Error Alert!")
End Try
What I have tried:
I have tried different means of declaring the variable
Some of the declarations tried are as stated listed below:
1.
Dim fs As New IO.FileStream(lblPath.Text + "/" + txtFoundationNo.Text + ".fpt", IO.FileMode.OpenOrCreate, IO.FileAccess.Write)
2.
Dim fs As New IO.FileStream(lblPath.Text + "/" + txtFoundationNo.Text + ".fpt", IO.FileMode.OpenOrCreate, IO.FileAccess.Write)
Using fs
Template.Serialize(fs)
End Using
I still end up getting the same error message.