Results 1 to 3 of 3

Thread: Linking 2 usercontrols

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    4

    Unhappy Linking 2 usercontrols

    Hello all ,

    i am creating an application that has 7 ActiveX

    Usercontorl objects.I have to link these 7 usercontrol

    so that when the user clicks a button in the first user

    control, the second one will be loaded.I tried Load

    usercontrol2 in the click event of the usercontrol1. But

    it is showing error.Anybody please help me

    Thanks in advance,
    Dhanya

  2. #2
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961
    Sure, post your code.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2004
    Posts
    4

    Re: Linking 2 usercontrols

    Hi Dave Sell,

    I am attaching the a sample zip file with this post.This sample application contains 2 usercontrols, userdetails and projectselect.When the program is executed the userdetails will be loaded in an Internert Explorer window.There is a button in the userdetails.Also one controlarraay object for the projectselect usercontrol named porjectselect1(0).When the user clicks the button in the userdetails usercontrol, the projectselect should be loaded in the internert explorer window.but now it is not loading. The userdetails is remaining there in the usercontrol.

    Some private declaration:
    --------------------------
    Private Declare Function GetClientRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    Private Declare Sub InitCommonControls Lib "COMCTL32" ()
    Private Declare Function SetErrorMode Lib "kernel32" (ByVal wMode As Long) As Long
    Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long


    Public Property Get hwnd() As Long
    hwnd = UserControl.hwnd
    End Property



    In Userdetails control, when the button is clicked:
    ------------------------------------------------
    Private Sub Command1_Click()
    Dim iIndex As Long

    iIndex = projectselect1.Count
    Load projectselect1(iIndex)
    With projectselect1(iIndex)
    .Visible = True
    .SetFocus
    End With
    SetParent projectselect1(iIndex).hwnd, GetParent(UserControl.hwnd)

    End Sub

    -------------------------------
    Could u please help me to sort out this,


    Thanks

    Dhanya
    Attached Files Attached Files

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