I am building a PC application in VB.NET using Visual Studio 2008 and the .NET 3.5 Framework.
I use the following code to pop dialogboxes when certain buttons are pressed:
Dim T As Type = Type.GetType(Application.ProductName & "." & dlgname, True, True)
Dim f As Form = CType(Activator.CreateInstance(T), Form)
f.BackgroundImage = Image.FromFile(apppath & "/images/popuptemplate.jpg")
In the above, dlgname is a text string with the name of the dialogbox I wish to pop. The above code works perfectly.
In one of my dialogbox's, I need to enable a disabled button on the tab control tab within the main window that contains the button which pops the dialogbox (by calling the above code). I'm using the code below to try to enable the disabled button. The code compiles, but the line below throws a generic runtime error without much diagnostic information (what little is provided seems to say that the entity referred to does not exist, probably because my syntax is wrong):
Me.ParentForm.Controls.Item("tcMain").Controls.Item("tabManageAssets").Controls.Item("btnMAEditAsset").Enabled = True
In the above, btnMAEditAsset is the button I wish to change from disabled to enabled state. Both the popup launcher button and the button whose enabled state I wish to change are contained within tabManageAssets. This command is my final line of the dialogbox code before Me.Close(). tcMain is the tab control on the main form, and tabManageAssets is the operant tab containing the two buttons.
Can anyone tell me what the correct syntax is to set the enabled state for btnMAEditAsset?
Thanks, Stu Engelman