is there a more efficient way of coding this
VB.NET:
Dim lesson As String = cmbSession.SelectedIndex
Dim changed As String = lstNames.SelectedItem
Dim chosen As String = cmbChange.SelectedIndex
If lstupdate.Items.Count = 10 Then
MsgBox("Classes can have a maximum of 10 students")
Return
End If
lstNames.Items.Remove(changed)
lstupdate.Items.Add(changed)
If lesson = 0 Then
Dim copyback1 As StreamWriter = File.CreateText("SaturdayCloud.txt")
For Each entry1 As Object In lstNames.Items
copyback1.WriteLine(entry1)
Next
copyback1.Close()
ElseIf lesson = 1 Then
Dim copyback2 As StreamWriter = File.CreateText("wednesdaycloud.txt")
For Each entry2 As Object In lstNames.Items
copyback2.WriteLine(entry2)
Next
copyback2.Close()
ElseIf lesson = 2 Then
Dim copyback3 As StreamWriter = File.CreateText("wednesdaymotoko.txt")
For Each entry3 As Object In lstNames.Items
copyback3.WriteLine(entry3)
Next
copyback3.Close()
ElseIf lesson = 3 Then
Dim copyback4 As StreamWriter = File.CreateText("tuesdayMotoko.txt")
For Each entry4 As Object In lstNames.Items
copyback4.WriteLine(entry4)
Next
copyback4.Close()
End If
If chosen = 0 Then
Dim saveback1 As StreamWriter = File.CreateText("SaturdayCloud.txt")
For Each entry1 As Object In lstupdate.Items
saveback1.WriteLine(entry1)
Next
saveback1.Close()
ElseIf chosen = 1 Then
Dim saveback2 As StreamWriter = File.CreateText("wednesdaycloud.txt")
For Each entry2 As Object In lstupdate.Items
saveback2.WriteLine(entry2)
Next
saveback2.Close()
ElseIf chosen = 2 Then
Dim saveback3 As StreamWriter = File.CreateText("wednesdaymotoko.txt")
For Each entry3 As Object In lstupdate.Items
saveback3.WriteLine(entry3)
Next
saveback3.Close()
ElseIf chosen = 3 Then
Dim saveback4 As StreamWriter = File.CreateText("tuesdayMotoko.txt")
For Each entry4 As Object In lstupdate.Items
saveback4.WriteLine(entry4)
Next
saveback4.Close()
End If