Created
March 1, 2014 17:37
-
-
Save anonymous/9293735 to your computer and use it in GitHub Desktop.
crash override visual basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.IO | |
Imports Microsoft.VisualBasic.FileIO | |
Public Class frmContactsManager | |
Private Structure Contact | |
'variables | |
Public strFirstName As String | |
Public strLastName As String | |
Public strPhoneNumber As String | |
Public strNicknames() As String | |
End Structure | |
'Dim ContactReader As StreamReader | |
Private Sub lblLastName_Click(sender As System.Object, e As System.EventArgs) Handles lblLastName.Click | |
End Sub | |
Private Sub btnNextContact_Click(sender As System.Object, e As System.EventArgs) Handles btnNextContact.Click | |
End Sub | |
Private Sub btnPrevious_Click(sender As System.Object, e As System.EventArgs) Handles btnPrevious.Click | |
End Sub | |
Private Sub lblNicknames_Click(sender As System.Object, e As System.EventArgs) Handles lblNicknames.Click | |
End Sub | |
Private Sub lblPhoneNumber_Click(sender As System.Object, e As System.EventArgs) Handles lblPhoneNumber.Click | |
End Sub | |
Private Sub lblFirst_Click(sender As System.Object, e As System.EventArgs) Handles lblFirst.Click | |
End Sub | |
Private Sub txtLastName_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtLastName.TextChanged | |
End Sub | |
Private Sub txtPhoneNumber_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtPhoneNumber.TextChanged | |
End Sub | |
Private Sub txtFirstName_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtFirstName.TextChanged | |
End Sub | |
Private Sub txtNicknames_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtNicknames.TextChanged | |
End Sub | |
Public Sub frmContactsManager_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load | |
End Sub | |
Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click | |
End Sub | |
'Button1 is "load contacts" button | |
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click | |
Using MyReader As New TextFieldParser("contacts_new.csv") | |
Dim intCounter As Integer = 0 | |
MyReader.TextFieldType = Microsoft.VisualBasic.FileIO.FieldType.Delimited | |
MyReader.Delimiters = New String() {","} | |
Dim currentRow As String() | |
Dim txtFirstN() As String | |
Dim txtLastN() As String | |
Dim txtPhoneN() As String | |
Dim txtNick() As String | |
'Loop through all fields in the file | |
'If any lines are corrupt, report error and keep parsing | |
While Not MyReader.EndOfData | |
Try | |
currentRow = MyReader.ReadFields() | |
For intCounter = 0 To 1 | |
txtFirstName.Text = currentRow(intCounter) + vbCrLf + " " | |
Next | |
txtFirstName.Text = txtFirstN(0) | |
Catch ex As Exception | |
End Try | |
Try | |
currentRow = MyReader.ReadFields() | |
For intCounter = 0 To 1 | |
txtLastName.Text = currentRow(intCounter) + vbCrLf + " " | |
Next | |
txtLastName.Text = txtLastN(0) | |
Catch ex As Exception | |
End Try | |
Try | |
Catch ex As Exception | |
End Try | |
currentRow = MyReader.ReadFields() | |
For intCounter = 0 To 1 | |
txtPhoneNumber.Text = currentRow(intCounter) + vbCrLf + " " | |
Next | |
txtPhoneNumber.Text = txtPhoneN(0) | |
Try | |
currentRow = MyReader.ReadFields() | |
For intCounter = 0 To 1 | |
txtNicknames.Text = currentRow(intCounter) + vbCrLf + " " | |
Next | |
txtNicknames.Text = txtNick(0) | |
Catch ex As Exception | |
End Try | |
End While | |
End Using | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment