Results 1 to 6 of 6

Thread: [RESOLVED]how do i create an object

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    226

    Resolved [RESOLVED]how do i create an object

    as the title says....how to i create an object and allow it to change size and move ect....
    Last edited by Ebiru; May 3rd, 2006 at 02:26 PM.

  2. #2
    Addicted Member
    Join Date
    Apr 2006
    Posts
    155

    Re: how do i create an object

    VB Code:
    1. Function CreateTextBoxes(txtBox As Object, ByVal HowMany As Long) As Boolean
    2.  Static i As Integer, d As Integer
    3.     On Error GoTo err
    4.             i% = txtBox.Count
    5.                     For d% = i% To i% + HowMany&
    6.                         Load txtBox(d%)
    7.                             txtBox(d%).Visible = True 'MAKE IT VISIBLE
    8.                           Randomize
    9.                             txtBox(d%).Move Rnd * ScaleWidth, Rnd * ScaleHeight 'Randomize position on the form.
    10.                     Next d%
    11.                         CreateTextBoxes = True
    12. err:
    13.     If err.Number = 438 Then 'Object doesn't support this method
    14.             CreateTextBoxes = False
    15.     End If
    16. End Function

    create a textbox on your form and call it whatever you want then put this in a command button:

    CreateTextboxes (nameoftextbox), 5

    'This will create 5 new arrays of (nameoftextbox). You can do this with other objects too like PictureBox, but since you're loading it your gonna have to write code to make it Visible and where to move it , I added these 2 lines for you, which you can edit to your likings.


    or if you want to check if it returned true or false put this in a command button and place a label on your form

    Label1.Caption = CreateTextBoxes(nameoftextbox, 5)

  3. #3
    Lively Member
    Join Date
    Apr 2006
    Location
    Planet Earth
    Posts
    64

    Re: how do i create an object

    what do u mean by object? as in buttons, textbox?
    I'm Still learning!
    satisfied/not satisfied, PLEASE TAKE SOME TIME TO rate me accordingly.
    Ur opinions helps me to be better!


    Appreciation Triggers Another Good Deeds.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    226

    Re: how do i create an object

    as a shape without useing a pic box or a shape...i want the program itself to make it

  5. #5
    Addicted Member
    Join Date
    Apr 2006
    Posts
    155

    Re: how do i create an object

    Try this then:

    VB Code:
    1. Set Rectangle = Controls.Add("VB.Shape", "Rectangle", Me)
    2. With Rectangle
    3.     .Top = 100
    4.     .Left = 100
    5.     .Visible = True
    6. End With

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2006
    Posts
    226

    Re: how do i create an object

    perfect ty this problem is solve

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