Problem with creating image Control array dynamically


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 6 of 6

Thread: Problem with creating image Control array dynamically

  1. #1
    Shravan Guest

    Problem with creating image Control array dynamically


    Hi,
    I'm facing problem with my control creation. Its like, I have created
    an image Control seed on the form and set its invisible property to true.
    But when I try to use the image control array in the code using
    Load imgFabric(intI), its issuing an error which says
    Run-time error '424'
    Object required.

    An anyone suggest anything on this?

    shravan


  2. #2
    Bernie Guest

    Re: Problem with creating image Control array dynamically


    "Shravan" <shravan79@hotmail.com> wrote:
    >
    >Hi,
    > I'm facing problem with my control creation. Its like, I have created
    >an image Control seed on the form and set its invisible property to true.
    >But when I try to use the image control array in the code using
    >Load imgFabric(intI), its issuing an error which says
    > Run-time error '424'
    > Object required.
    >
    >An anyone suggest anything on this?
    >
    >shravan
    >


    Hi,
    Be sure the seedcontrol is an array by setting it's index to 0.
    Bernie

  3. #3
    Shravan Guest

    Re: Problem with creating image Control array dynamically


    Bernie,
    Yes the seed control is indexed with 0 and its an array. But still
    I'm having a problem with this. The thing is I'm using this Contol in a procedure
    which is called by clicking other controls on the form and is not specific
    to a control's code. Does it has anything to do with this??

    shravan

    "Bernie" <magnus.bernroth@rejlers.se> wrote:
    >
    >"Shravan" <shravan79@hotmail.com> wrote:
    >>
    >>Hi,
    >> I'm facing problem with my control creation. Its like, I have created
    >>an image Control seed on the form and set its invisible property to true.
    >>But when I try to use the image control array in the code using
    >>Load imgFabric(intI), its issuing an error which says
    >> Run-time error '424'
    >> Object required.
    >>
    >>An anyone suggest anything on this?
    >>
    >>shravan
    >>

    >
    >Hi,
    >Be sure the seedcontrol is an array by setting it's index to 0.
    >Bernie



  4. #4
    Bernie Guest

    Re: Problem with creating image Control array dynamically


    Hm...
    Hard to tell without seeing the code...
    Bernie

    "Shravan" <shravan79@hotmail.com> wrote:
    >
    >Bernie,
    > Yes the seed control is indexed with 0 and its an array. But still
    >I'm having a problem with this. The thing is I'm using this Contol in a

    procedure
    >which is called by clicking other controls on the form and is not specific
    >to a control's code. Does it has anything to do with this??
    >
    >shravan
    >
    >"Bernie" <magnus.bernroth@rejlers.se> wrote:
    >>
    >>"Shravan" <shravan79@hotmail.com> wrote:
    >>>
    >>>Hi,
    >>> I'm facing problem with my control creation. Its like, I have created
    >>>an image Control seed on the form and set its invisible property to true.
    >>>But when I try to use the image control array in the code using
    >>>Load imgFabric(intI), its issuing an error which says
    >>> Run-time error '424'
    >>> Object required.
    >>>
    >>>An anyone suggest anything on this?
    >>>
    >>>shravan
    >>>

    >>
    >>Hi,
    >>Be sure the seedcontrol is an array by setting it's index to 0.
    >>Bernie

    >



  5. #5
    Makuko Guest

    Re: Problem with creating image Control array dynamically


    "Shravan" <shravan79@hotmail.com> wrote:
    >
    >Hi,
    > I'm facing problem with my control creation. Its like, I have created
    >an image Control seed on the form and set its invisible property to true.
    >But when I try to use the image control array in the code using
    >Load imgFabric(intI), its issuing an error which says
    > Run-time error '424'
    > Object required.
    >
    >An anyone suggest anything on this?
    >
    >shravan
    >

    Hi Shravan

    Try with this code in a new form with one picture control called Pic and
    one command button
    Note that the first value for i is 1 and not 0 because Pic(0) already exist
    at form so you can't create a control that already exist.


    Private Sub Command1_Click()
    For i = 1 To 4
    Load pic(i)
    pic(i).Visible = True
    pic(i).Top = pic(i).Top + pic(i).Height * i
    Next
    End Sub



  6. #6
    Wee G Guest

    Re: Problem with creating image Control array dynamically


    "Shravan" <shravan79@hotmail.com> wrote:
    >
    >Bernie,
    > Yes the seed control is indexed with 0 and its an array. But still
    >I'm having a problem with this. The thing is I'm using this Contol in a

    procedure
    >which is called by clicking other controls on the form and is not specific
    >to a control's code. Does it has anything to do with this??
    >
    >shravan
    >
    >"Bernie" <magnus.bernroth@rejlers.se> wrote:
    >>
    >>"Shravan" <shravan79@hotmail.com> wrote:
    >>>
    >>>Hi,
    >>> I'm facing problem with my control creation. Its like, I have created
    >>>an image Control seed on the form and set its invisible property to true.
    >>>But when I try to use the image control array in the code using
    >>>Load imgFabric(intI), its issuing an error which says
    >>> Run-time error '424'
    >>> Object required.
    >>>
    >>>An anyone suggest anything on this?
    >>>
    >>>shravan
    >>>

    >>
    >>Hi,
    >>Be sure the seedcontrol is an array by setting it's index to 0.
    >>Bernie

    >

    Hi

    I have recently had a similar problem when I try to manipulate a picture
    box array, i wanted to lock all picture boxes in the array by passing the
    picture box to a procedure. When I tried passing the array and using a for
    loop to loop through the array I was getting the object required Error:
    I had to pass the array in as an object and use a for each loop to loop through
    it. This may be the same for your problem.

    See my code below:

    Public Sub lockPictures(picArray As Object)
    ' this sub routine locks all of the picture boxes on form load
    ' this will prevent the users from entering any information

    Dim Pic As PictureBox
    For Each Pic In picArray
    Pic.Enabled = False
    Next

    End Sub

    regards

    Graham, (wee g)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center