100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Other

ICT3611 Assignment 11 Answers

Rating
-
Sold
-
Pages
13
Uploaded on
27-08-2021
Written in
2021/2022

ICT3611 Assignment 11 Answers

Institution
Course








Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Course

Document information

Uploaded on
August 27, 2021
Number of pages
13
Written in
2021/2022
Type
Other
Person
Unknown

Subjects

Content preview

Chapter 3 - Programming Project 1 - Membership List
CODE
Public Class Form1
Dim file() As String = IO.File.ReadAllLines("Phones.txt")
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
MyBase.Load
Display()
End Sub

Private Sub lstMembers_SelectedIndexChanged(sender As Object, e As
EventArgs) Handles lstMembers.SelectedIndexChanged
'loop through the file and find name that matches the selected text
in the list box
'and return the name and appropriate phone number
Dim query = From p In file
Let name As String = p.ToString.Split(",")(0)
Let phone = p.ToString.Split(",")(1)
Where name = lstMembers.SelectedItem
Select name, phone

txtName.Text = query.ToList.First.name.ToString
mtbPhone.Text = query.ToList.First.phone.ToString
End Sub

Private Sub mnuAdd_Click(sender As Object, e As EventArgs) Handles
mnuAdd.Click
'if name has been entered into text boxes, append it to the file
If (txtName.Text <> "") And (mtbPhone.Text <> "") Then
ReDim Preserve file(file.Count) 'add one more index to array
file(file.Count - 1) = txtName.Text + "," + mtbPhone.Text
Display()
Else
MessageBox.Show("Nothing to add")
End If
End Sub

Private Sub mnuDelete_Click(sender As Object, e As EventArgs) Handles
mnuDelete.Click
Dim nameToDelete As String = lstMembers.SelectedItem

'we're deleting, so array now holds one less name than is in the
current file
Dim tempName(lstMembers.Items.Count - 2) As String

If nameToDelete <> "" Then
'select name to delete
Dim query = From n In file
Let name As String = n.Split(",")(0)
Where name <> nameToDelete
Select n

'write the temp data into array and display new list

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
hlogzaogza University of South Africa (Unisa)
Follow You need to be logged in order to follow users or courses
Sold
33
Member since
7 year
Number of followers
30
Documents
0
Last sold
3 months ago

3.9

8 reviews

5
3
4
1
3
4
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions