|
-
Apr 18th, 2005, 12:27 PM
#1
Thread Starter
Junior Member
For Loops
Basically, I really can't get this to work!
I've got this code:
VB Code:
If Index = 0 Then txtMegaDrive.Text = "Sonic 1"
VB Code:
If Index = 0 Then txtMegaDrive.BackColor = &HFFC0C0
VB Code:
If Index = 1 Then txtMegaDrive.Text = "Sonic 3D"
VB Code:
If Index = 1 Then txtMegaDrive.BackColor = &HFF8080
etc until index 8. Is it possible to change this stuff into a For Loop?
I got stuck after writing:
Dim Count As Integer'
For Count = 0 To 7
Next Count
Thanks very much
-
Apr 18th, 2005, 12:35 PM
#2
Re: For Loops
This will change things once. If You use the loop, change the select to Count
and it will do all of them each time. I wasn't sure if that is what you wanted to do, though.
VB Code:
Select Case Index
case 0
txtMegaDrive.Text = "Sonic 1"
txtMegaDrive.BackColor = &HFFC0C0
case 1
txtMegaDrive.Text = "Sonic 3D"
txtMegaDrive.BackColor = &HFF8080
':
':
end select
-
Apr 18th, 2005, 01:02 PM
#3
Frenzied Member
Re: For Loops
 Originally Posted by BatmanSpider
Basically, I really can't get this to work!
I've got this code:
VB Code:
If Index = 0 Then txtMegaDrive.Text = "Sonic 1"
VB Code:
If Index = 0 Then txtMegaDrive.BackColor = &HFFC0C0
VB Code:
If Index = 1 Then txtMegaDrive.Text = "Sonic 3D"
VB Code:
If Index = 1 Then txtMegaDrive.BackColor = &HFF8080
etc until index 8. Is it possible to change this stuff into a For Loop?
I got stuck after writing:
Dim Count As Integer'
For Count = 0 To 7
Next Count
Thanks very much
If the Text you are assigning and the color you are using are in an array then the loop will be appropriate.. otherwise.. useless...
-
Apr 18th, 2005, 01:34 PM
#4
Need-a-life Member
Re: For Loops
 Originally Posted by moinkhan
If the Text you are assigning and the color you are using are in an array then the loop will be appropriate.. otherwise.. useless...
If they were in an array, the loop might also be useless:
VB Code:
txtMegaDrive.Text = MDriveText(Index)
txtMegaDrive.BackColor = MDriveBColor(Index)
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Apr 18th, 2005, 02:26 PM
#5
Frenzied Member
Re: For Loops
 Originally Posted by Mc Brain
If they were in an array, the loop might also be useless:
VB Code:
txtMegaDrive.Text = MDriveText(Index)
txtMegaDrive.BackColor = MDriveBColor(Index)
exactly....
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
|