|
-
Jun 23rd, 2004, 09:57 AM
#1
Thread Starter
Addicted Member
Do While Statement
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:
Private Sub btnWhile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWhile.Click
Dim sbMessage As New System.Text.StringBuilder
Dim liTemp As ListViewItem
If lstParts.SelectedItems.Count > 0 Then
sbMessage.Append("This is a Do While loop and you chose the following items:").Append(vbCrLf)
For Each liTemp In lstParts.Items
If liTemp.Selected = True Then sbMessage.Append(liTemp.Text).Append(vbCrLf)
Next
txtLoop.Text = (sbMessage.ToString)
Else
MessageBox.Show("You did not select any items", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
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???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|