can't change label on inherited (panel) control

  • Thread starter Thread starter Sjaakie Helderhorst
  • Start date Start date
S

Sjaakie Helderhorst

Hi there,

I created my own user control (myControl) containing:
myCaption - docked top
myGrid - docked.fill (datasource: myDataset)
myPanel - docked bottom

This control is added to the form: form1.controls.add(myControl)
I wish to change label-value on myPanel whenever a value of myDataset has
changed (by editing the grid). Since dataset.onchange doesn't exists, what
events is triggered on change?

I tried to manually change the label-value (mycontrol.myPanel.lblTotal.Text
= "sometext"), from Form1. This had no effect at all. However I CAN set a
default value at initialisation of myPanel. How come?

Thanks in advance!
 
Hello,

One solution is to add a public property to your user control that exposes
the Label to client code.

Public Property TotalLabel() As Label
Get
Return lblTotal
End Get
Set (ByVal value As Label)
lblTotal = value
End Set
End Property


--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
 
Great that did the trick, now I only need to know the catch the event
whenever a dataset is changed.
 
Back
Top