PDA

View Full Version : A Real Basic Question...




G4scott
Jan 16, 2003, 08:37 PM
Get it, a real basic, as in REALBasic Question.... :p

I'm just a beginner, but I seem to be doing fine...

anyways, I need some help... I have a whole bunch of edit fields (EditField1 - EditField167), and I need to pull out all of .text values, and put them into some other variables... I've already created the variables and all, and need to know if there's an easy way to do this... I know that this will work:

nField(0) = EditField1.Text
nField(1) = EditField2.Text
nField(2) = EditField3.Text
... so on, and so forth...

Now, is there any way to use the For command to make this all easy, by doing something like this:

For n1 = 1 to 167
nField(n1-1) = EditField(str(n1)).text
Next

I tried it, but I can't figure out a way to control the EditField number with an integer like that... Does anybody know how to get this to work... It will really cut down on how much work I have to do, and it will definately give me more insight to what I'm doing. Thanks!



cubist
Jan 16, 2003, 09:04 PM
When I find myself in times of trouble
K&R they come to me
Speaking words of wisdom,
Code in C...

G4scott
Jan 16, 2003, 09:25 PM
Originally posted by cubist
When I find myself in times of trouble
K&R they come to me
Speaking words of wisdom,
Code in C...

Hey, I'm just a beginner trying to program a wonderful little GPA calculator for my school... No biggie here, I'm just learning...

When I get to it, I'll learn C (or C+ or C++, or whatever...)

Maybe some inspirational music would help... Hmm... Maybe some Beatles would help :cool:

gbojim
Jan 16, 2003, 09:46 PM
I know you can do this in Visual Basic but I have not tried it in Real Basic. You should be able to create an array of edit fields. You would also want to declare nField as an array of strings.

Your code would then look something like:

for n = 0 to 166
nField(n) = EditField(n).text
next n

G4scott
Jan 16, 2003, 10:18 PM
Originally posted by gbojim
I know you can do this in Visual Basic but I have not tried it in Real Basic. You should be able to create an array of edit fields. You would also want to declare nField as an array of strings.

Your code would then look something like:

for n = 0 to 166
nField(n) = EditField(n).text
next n

I've tried stuff like that, and it doesn't let me, because the EditFields are Controls, and it's very stingy about them...