Hi Vince,
I know it's frustrating but here's what I did.
First, I declared public variables to hold references to the toolbars in my parent form.
dim toolAdd as ToolBarButton
dim toolDelete as ToolBarButton 'and so on
Second, in the Load event of my parent form, I set references to the toolbars
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
toolAdd = tbMain.Buttons(ADD_BUTTON)
toolDelete = tbMain.Buttons(DELETE_BUTTON)
End Sub
Once set, I can now change properties of the toolbar in my parent form just by coding:
toolAdd.Enabled = True
toolDelete.Enabled = False
I think the downside of this though is that you declare a number of public variables (depending on how many parent controls do you need to have access to) which can take up memory space.
Lulu
Quote:
quote:Originally posted by Vince
Can anyone please advise how I refer to another forms controls in VB.NET
I have one Parent form and two Child forms I want to set the enable properties to false on the parent form toolbar from the child forms. In VB6 it just used to be parent.tbar.button1.enable = false. Now itâs ?????? FRUSTRAITING!!!
|