Results 1 to 7 of 7

Thread: How to create a TextBox array ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2004
    Posts
    84

    How to create a TextBox array ?

    I have an application for about 1000 text boxes and therefore I need an array.
    Unfortunately I do not remember how to go about .

    Your help is appreciated

    RobertXYZ

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: How to create a TextBox array ?

    Select the text box control and Copy then Paste as many as you want.



  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: How to create a TextBox array ?

    Or place a text box on your form, set the Index property to 0 and then load the rest at runtime using the Load method in a loop.

    1000 textboxes sounds like far to many to have on a form though. A simple interface is generally the best way to go.

  4. #4
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,289

    Re: How to create a TextBox array ?

    You can get glist and use it with 1000 editable items. Find it in the nice textboxes in the code bank. See the font selector.The one half of it, the lower one, has a menu style glist, with 2 editable lines, the size and code page. Also in that menu some other lines are check boxes. You can place radio boxes. All of them are items in a scrollable list box.

  5. #5
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: How to create a TextBox array ?

    DataMiser already gave you the answer, but follow his lead and here's a piece of code that'll illustrate it for you.

    And actually, I'm not sure if I've approached 1000, but, using the Tab control, I've gotten several hundred controls on a form before. My most complex ones are for the data entry of physical therapy data where a therapist takes 100s of measurements in a single setting. They like the feel of having it all on one screen even if it is on several tabs. With a minimum of about 2gig of memory in machines these days, it's just not a problem.

    Code:
    Private Sub Form_Load()
        Dim i As Long
        For i = 1 To 10
            Load Text1(i)
            Text1(i).Top = Text1(i - 1).Top + Text1(i - 1).Height
            Text1(i).Visible = True
        Next i
    End Sub
    Again, as DataMiser says, create a form, throw a textbox (Text1) on it, give the index a value of 0, and then execute the above and watch the magic.

  6. #6
    Addicted Member
    Join Date
    Jul 2014
    Posts
    176

    Re: How to create a TextBox array ?

    Seriously 1000 textboxes?

    From my experience, there is a limit for the number of controls that a form can handle...

    But I'll go with DM's solution.
    If I had helped you...

    Don't forget to mark your Inquiry as RESOLVED...

    I will be glad if you can also give me some Reputation points in helping you (by Clicking Rate This Post)...

    Happy VB Coding Everyone!

  7. #7
    Frenzied Member
    Join Date
    May 2014
    Location
    Kallithea Attikis, Greece
    Posts
    1,289

    Re: How to create a TextBox array ?

    The idea here is to use one control for many inputs and not many controls for many inputs...

    Before some years (15+) I make a beautiful piece of code...using mdb files and a web control. So I without prepare textboxes...on the form with one control I load html files created on the fly, with tables and input text boxes, so every time (used that in a spa enterprise ) the fill numbers about weight and other measures and some info in a web page, and click a button to send...No server or client used, I just use a method to catch the header. So with one control I would able to make ready to display and print forms. I put a menu and i have subs that create html files and display it, and some of them was for reading the user name and password, some to choose person (so the data was for every person that take a fitness work), some for input values (and display lines from old input also, because there was a series of measures to become on set, and for that we needed a week to spend, so we put numbers some days in a week to make a graph of values in a book later), and final some for reading history of measures.
    If I want to add some new measure was easy because all measures become a single string in one field "memo" in database,

    (I found 15 later, yesterday, that I can store unicode to mdb access 97 file, using OLE (no 12) field type, because that is long binary and never changed using internal work to the ANSI charset)

    So RobertXYZ tell us the nature of using 1000 textboxes. Should be have all of them a label? Because you can use one only textbox and change a lable over it (or in on side) to clarify to the user what purpose is that textbox. And you can have a label over it and display the previously enterted values as a text like that "ASM=12kl, KLM=1.3mm" This string can be the store container and drop it in a memo field using a date and person id as a key. For each specific lab work you can make strings of special measures like this "Bp1=###.##kl, aB2=###.##mm" as a base to start using the only one textbox...(with multiple role)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width