Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Linking UserControls


Linking UserControls

Author
Message
dhanya
dhanya
Forum God
Forum God (506 reputation)Forum God (506 reputation)Forum God (506 reputation)Forum God (506 reputation)Forum God (506 reputation)Forum God (506 reputation)Forum God (506 reputation)Forum God (506 reputation)Forum God (506 reputation)

Group: Forum Members
Posts: 2, Visits: 1
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

Destroyer
Destroyer
Forum God
Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)Forum God (42K reputation)

Group: Forum Members
Posts: 244, Visits: 188
If I'm reading correctly and your user control is called UserControl1, it'll
be UserControl11 when you drop it on a form.

Once it's on a form, set its Index property = 0. That creates a control
array. Once it's an array, you can use Load to load as many as required.

'=============UserControl Code
Option Explicit

Public Event Click()

Private Sub UserControl_Click()
   RaiseEvent Click
End Sub

Private Sub UserControl_Initialize()
   'Give it some color so you can see it.
   UserControl.BackColor = RGB(Rnd * 255, Rnd * 255, Rnd * 255)
End Sub
'=============Form Code
Option Explicit

Private Sub UserControl11_Click(Index As Integer)
   If Index = UserControl11.UBound Then
      Load UserControl11(Index + 1)
      With UserControl11(Index)
         UserControl11(Index + 1).Move .Left, .Top + .Height, .Width,
.Height
      End With
      UserControl11(Index + 1).Visible = True
   End If
End Sub


Destroyer Smooooth
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search