A Real Basic Question...

Discussion in 'Mac Help/Tips' started by G4scott, Jan 16, 2003.

  1. G4scott macrumors 68020

    G4scott

    Joined:
    Jan 9, 2002
    Location:
    Austin, TX
    #1
    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!
     
  2. cubist macrumors 68020

    Joined:
    Jul 4, 2002
    Location:
    Muncie, Indiana
    #2
    When I find myself in times of trouble
    K&R they come to me
    Speaking words of wisdom,
    Code in C...
     
  3. G4scott thread starter macrumors 68020

    G4scott

    Joined:
    Jan 9, 2002
    Location:
    Austin, TX
    #3
    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:
     
  4. gbojim macrumors 6502

    Joined:
    Jan 30, 2002
    #4
    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
     
  5. G4scott thread starter macrumors 68020

    G4scott

    Joined:
    Jan 9, 2002
    Location:
    Austin, TX
    #5
    I've tried stuff like that, and it doesn't let me, because the EditFields are Controls, and it's very stingy about them...
     

Share This Page