I have 20 integers in an array and I am picking out all the even numbers. But then I am supposed to display all of them in a message box. I can display them in a Label
For Each x As Integer In MyArray
If x Mod 2 = 0 Then
Label2.Text = Label2.Text & x.ToString & ", "
End If
Next x
But when I change it to
message = message & x.ToString & ", "
MessageBox.Show(message, "Name", MessageBoxButtons.OK, MessageBoxIcon.Information)
The second 'message' has the green scribbled line and the error that the variable message has been assigned before it has been assigned a value. The numbers will show, but in one message box at a time. What am I forgetting? Any ideas?
2007-10-12
12:12:32
·
3 answers
·
asked by
VBnewbieANDherHubby
3
in
Computers & Internet
➔ Programming & Design
I did declare the message, that is why it is weired, it only underlines the second 'message', not the first one.
2007-10-12
12:23:46 ·
update #1
message (this one is not underlined) = message(this one is) & x.ToString & ", "
2007-10-12
12:25:01 ·
update #2
MARK:
Thanks you are the bomb!!!! I got it to work that everything shows in one message box. Will try to get rid of the underline now! THANKS!!!!
2007-10-12
12:51:54 ·
update #3