03xc600
asked on
A few small vb questions
1. What does the following statement do? I am doing some review and cannot figure a few of these out.
outputLabel.Text = someListBox.Items(someList Box.Select edIndex))
2. what is th value of I?
Dim n As Integer = 0
Dim i As Integer
Dim j As Integer
For i = 0 To 5
For j = 0 To 5
n += 1
Next j
Next i
3. what is the value of I?
Dim i As Integer
For i = 0 To 10
If i = 5 Then
Exit For
End If
Next i
4. What is wrong with the following loop?
Dim i as Integer
For i = 20 To 0
'(some code)
Next i
5. Which of the following loops will execute at least once and will end when the condition becomes True?
Do While condition / Loop
Do Until condition / Loop
Do / Loop While condition
Do / Loop Until condition
outputLabel.Text = someListBox.Items(someList
2. what is th value of I?
Dim n As Integer = 0
Dim i As Integer
Dim j As Integer
For i = 0 To 5
For j = 0 To 5
n += 1
Next j
Next i
3. what is the value of I?
Dim i As Integer
For i = 0 To 10
If i = 5 Then
Exit For
End If
Next i
4. What is wrong with the following loop?
Dim i as Integer
For i = 20 To 0
'(some code)
Next i
5. Which of the following loops will execute at least once and will end when the condition becomes True?
Do While condition / Loop
Do Until condition / Loop
Do / Loop While condition
Do / Loop Until condition
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1.
outputLabel.Text = someListBox.Items(someList
This may throw exception if listbox donot hav string object. So try to assign displaytext or someListBox.Items(someList
>>2. 36 right?
it can't be, the value of I range from 0 to 5 so its value after the loop is 6 (1 more then the greater value).
it can't be, the value of I range from 0 to 5 so its value after the loop is 6 (1 more then the greater value).
oh! sorry - I. I went after n
ASKER
thanks guys, i think that the second one was 36, but i am not sure
>>i think that the second one was 36, but i am not sure
it can't be, the value of I range from 0 to 5 so its value after the loop is 6 (1 more then the greater value). Drop the code into a test form and test it.
it can't be, the value of I range from 0 to 5 so its value after the loop is 6 (1 more then the greater value). Drop the code into a test form and test it.
Is this homework?