| | |
Null Reference Exception Unhandled
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 2
Reputation:
Solved Threads: 0
I am getting the above error from the following code and I a not understanding why.
VB.NET Syntax (Toggle Plain Text)
fileWriter.WriteLine( _ record.strFirstName & "," & record.strLastName & "," & _ record.strStudentId & "," & record.strCourseName & "," & _ record.strGrade)
•
•
Join Date: Nov 2008
Posts: 2
Reputation:
Solved Threads: 0
Here is the entire code, I figured out why I am getting the above error yet I am not able to get the code to write to the file that is created.
•
•
•
•
VB.NET Syntax (Toggle Plain Text)
Private Sub btnEnter_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles btnEnter.Click Dim values As String() = GetTextBoxValues() Dim record As New GradeBookDataCollector() Me.SetTextBoxValues(GetTextBoxValues) If values(TextBoxIndices.txtFirstName) <> "" Then Try Dim strFirstName As String = _ values(TextBoxIndices.txtFirstName) If strFirstName <> "" Then record.strFirstName = values(TextBoxIndices.txtFirstName) record.strLastName = values(TextBoxIndices.txtLastName) record.strCourseName = values(ComboBoxIndices.cboCourseName) record.strStudentId = values(TextBoxIndices.txtStudentId) record.strGrade = values(ComboBoxIndices.cboGrade) fileWriter.WriteLine( _ record.strFirstName.ToString & "," & record.strLastName.ToString & "," & _ record.strStudentId.ToString & "," & record.strCourseName.ToString & "," & _ record.strGrade.ToString) Else MessageBox.Show("Invalid First Name", "Error", _ MessageBoxButtons.OK, MessageBoxIcon.Error) End If Catch ex As IOException MessageBox.Show("Error Writing to File", "Error", _ MessageBoxButtons.OK, MessageBoxIcon.Error) Catch ex As FormatException MessageBox.Show("Invalid Format", "Error", _ MessageBoxButtons.OK, MessageBoxIcon.Error) End Try End If Me.SetTextBoxValues(GetTextBoxValues) Me.ClearFormDataEntryBoxes() End Sub (Rate)
![]() |
Similar Threads
- Unhandled Exception Error (VB.NET)
- Datagrid Problem!!!!!!! (VB.NET)
- another question (C++)
Other Threads in the VB.NET Forum
- Previous Thread: Need advice on sockets/threads
- Next Thread: OOLEDB Connection(vb.net & Access)
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic beginner browser button buttons center checkbox client code convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel fade filter forms ftp generatetags gridview html images inline input insert intel internet lib listview mobile monitor net objects open panel passingparameters pdf picturebox port position print printing problem read remove save searchvb.net select serial settings shutdown soap sorting sqlserver survey table temperature textbox timer timespan transparency trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms wpf wrapingcode year





