I want users to select items from a ListView I've created containing: arm, hand, foot, etc.
I have 3 buttons being used: Do...While, Do...Next, and For...Next

I have finished the code for the For...Next button, but need to do the same for the Do...While button using a Do...While statement.

Does anyone know how I would edit my code to reflect a Do...While statement while still returning the same information??

VB Code:
  1. Private Sub btnWhile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWhile.Click
  2.         Dim sbMessage As New System.Text.StringBuilder
  3.         Dim liTemp As ListViewItem
  4.         If lstParts.SelectedItems.Count > 0 Then
  5.             sbMessage.Append("This is a Do While loop and you chose the following items:").Append(vbCrLf)
  6.             For Each liTemp In lstParts.Items
  7.                 If liTemp.Selected = True Then sbMessage.Append(liTemp.Text).Append(vbCrLf)
  8.             Next
  9.             txtLoop.Text = (sbMessage.ToString)
  10.         Else
  11.             MessageBox.Show("You did not select any items", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
  12.             Exit Sub
  13.         End If
  14.  
  15.     End Sub
It works fine like this and returns the information I want, but instead of using a For..Next statement I need to use a Do...While statement. Any ideas???