can't change label on inherited (panel) control

  • Thread starter Sjaakie Helderhorst
  • 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!
 
M

Mike McIntyre [MVP]

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
 
S

Sjaakie Helderhorst

Great that did the trick, now I only need to know the catch the event
whenever a dataset is changed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top