Ok so, here's what I'm doing. I'm putting together a program that will allow employees that work under me to all submit shift reports in the same format instead of getting multiple different formatted text files.
I have a list box that they add "actions" they've performed throughout the day. It's populated by a combo box and some text boxes.
I've got it all functioning minus one aspect... First, here's my code..
First, I setup a Class
This is the code that adds the items to the list box
Ok, then I put this code to output the data to the text file..
Here's my problem... it's only outputting the FIRST set of items. The "Upgraded" accounts all list but the "Downgraded" and "Canceled" are not there.
In a perfect world, I wouldn't ever need to worry about "Canceled" or "Downgraded" but... the world isn't perfect so, I need em!
Any ideas what I'm doing wrong here?
I have a list box that they add "actions" they've performed throughout the day. It's populated by a combo box and some text boxes.
I've got it all functioning minus one aspect... First, here's my code..
First, I setup a Class
VB.NET:
Public Class AccountListItems
Public AccountNumber As String
Public Action As String
Public AccountName As String
Public AccountReason As String
Public Overrides Function ToString() As String
Return Action & " - " & AccountNumber & " - " & AccountName & " - " & AccountReason
End Function
End Class
This is the code that adds the items to the list box
VB.NET:
Dim li As New AccountListItems
li.AccountNumber = txtAccountNum.Text
li.AccountName = txtAccountName.Text
li.Action = cmbModActions.Text
li.AccountReason = txtReason.Text
lstModActions.Items.Add(li)
Ok, then I put this code to output the data to the text file..
VB.NET:
Dim UpgradedAccounts = From li as AccountListItems in ListBox1.Items Where li.Action = "upgraded"
Dim DowngradedAccounts = From li as AccountListItems in ListBox1.Items Where li.Action = "downgraded"
Dim CancelledAccounts = From li as AccountListItems in ListBox1.Items Where li.Action = "cancelled"
TotalUpgraded = UpgradedAccounts.Count
TotalDowngraded = DowngradedAccounts.Count
TotalCancelled = CancelledAccounts.Count
sWriter.WriteLine("Upgraded Accounts")
For i = 0 to TotalUpgraded -1
sWriter.WriteLine(lstAccountActions.Items(i).ToString)
Next
sWriter.WriteLine("Downgraded Accounts")
For x = 0 to TotalDowngraded -1
sWriter.WriteLine(lstAccountActions.Items(x).ToString)
Next
sWriter.WriteLine("Cancelled Accounts")
For z = 0 to TotalCancelled - 1
sWriter.WriteLine(lstAccountActions.Items(z).ToString)
Next
Here's my problem... it's only outputting the FIRST set of items. The "Upgraded" accounts all list but the "Downgraded" and "Canceled" are not there.
In a perfect world, I wouldn't ever need to worry about "Canceled" or "Downgraded" but... the world isn't perfect so, I need em!
Any ideas what I'm doing wrong here?