A little help...

DeathBlade
07-18-2006, 06:11 PM
Ive worked in Flash for a very long time and i am having some troubles adjusting to the visual basic syntax. Here is a very simple piece of code, that runs through 9 text boxes i have layed out on the form, and if they have no text written in them writes some text there. i am getting a TON of errors converting from strings to doubles etc, and would greatly appreaciate a small push... thanx for all replies,

DeathBlade


i = 0

While (i < 9)
If (("Square" + i).Text) = "" Then
("Square"+i).text="THIS WAS EMPTY"
End If
i += 1
End While



there are 9 text boxes labeled in order "Square1","Square2", etc

calder
07-18-2006, 06:37 PM
Didn't I see this question before? lol

that doesn't work in VB (I saw a thread somewhere that made it work but forget where)


The easiest way to do this is to create a control array. Delete 8 of the text boxes. Copy and paste the one that is left. VB will ask you if you wish to create a control array answer yes. Then copy and paste until you have 9 boxes. Each one will have an index value in it's properties then you can run your code as follows:

Dim i as Integer

i = 0

for i = 0 to 9
If Square(i).Text = "" Then
Square(i).Text = "THIS WAS EMPTY"
End If
i = i +1
next i

DeathBlade
07-18-2006, 07:12 PM
Didn't I see this question before? lol

that doesn't work in VB (I saw a thread somewhere that made it work but forget where)


The easiest way to do this is to create a control array. Delete 8 of the text boxes. Copy and paste the one that is left. VB will ask you if you wish to create a control array answer yes. Then copy and paste until you have 9 boxes. Each one will have an index value in it's properties then you can run your code as follows:


i copied and pasted it but it gave me no array options. perhaps this is because i am using vb.net? do you know how to do the same thing under the .net interface?

DeathBlade
07-18-2006, 09:26 PM
nvm i did a little research and wasnt happy with what i found. seems like the complication level for something like this is vb.net has reached above my ability level. thanx for the contributions tho.

~DeathBlade

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum