Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program is to be done in visual basic I need both the code and the gui. The

ID: 3831291 • Letter: T

Question

This program is to be done in visual basic I need both the code and the gui.

The MemberPhones.txt contains the below info.

Langley, Judy
321-1111
Morgan, Fred
222-2222
Nixon, Mike
333-3333
Norton, Herbert
444-4444
Preiss, Carol
555-5555
Ree, Alice
666-6666
Sanchez, Carlos
777-7777
Smith, John
888-8888

Membership List Write a menu-driven program to manage a membership list. See Fig. 9.67. Assume that the names and phone numbers of all members are stored in alphabetical order (by last name, then by first name) in the text file MemberPhones.ixt. Membership L-D x Update Exit Modify F1 Add F2 Delete F3 caroTPress eRee Carlos Sanchez John Smith Name: Judy Langley Phone: 321-1111 FIGURE 9.67 Possible outcome of Programming Project l. Each record consists of two fields a name field and a phone number field. The names should appear in a list box when the form is loaded. When a name is highlighted, both the name and phone number of the person should appear in the text boxes at the bottom of the form. To delete a person, highlight his or her name and click on the Delete menu item. To change either a person's name or phone number, make the corrections in the text boxes and click on the menu item Modify. To add a new member, type the person's name and phone number into the text boxes and click on the menu item Add. When the Exit menu item is clicked, the new membership list should be written to the file and the program should terminate.

Explanation / Answer

Public Class Form1

Class Member

Public Name As String

Public Phone As String


End Class

Dim memberList As New List(Of Member)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim sr() As String = IO.File.ReadAllLines("residents.TXT")
Dim memberline() As String
For j As Integer = 0 To sr.Count - 1
MemberLine = sr(j).Split(","c)
ListBox1.Items.Add(memberline(0))

Next

End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim sr() As String = IO.File.ReadAllLines("residents.TXT")
Dim theindex As String = ListBox1.SelectedItem
Dim list() As String
list = sr(theindex).Split(","c)
TextBox1.Text = list(0)
TextBox2.Text = list(1)












End Sub

Private Sub ModifyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ModifyToolStripMenuItem.Click
memberList(ListBox1.SelectedIndex).Name = TextBox1.Text

memberList(ListBox1.SelectedIndex).Phone = TextBox2.Text
RefreshLstInfo()

End Sub

Private Sub AddToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddToolStripMenuItem.Click
Dim NewPerson As New Member

NewPerson.Name = TextBox1.Text

NewPerson.Phone = TextBox2.Text

ListBox1.Items.Add(TextBox1.Text & "," & TextBox2.Text)

RefreshLstInfo()

End Sub

Private Sub DeleteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteToolStripMenuItem.Click
memberList.RemoveAt(ListBox1.SelectedIndex)
RefreshLstInfo()

End Sub

Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
Application.Exit()

End Sub

Private Sub RefreshLstInfo()

ListBox1.Items.Clear()

For j As Integer = 0 To memberList.Count - 1

ListBox1.Items.Add(memberList(j).Name)

Next

End Sub
End Class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote