i am working on a database application project and i need to put some user authorization where it will change the visibility of button based on the role.
so i save all related form name in the database
then i retrieve all the form name from the database into my application
but i stuck with how to retrieve the button from only form name
my current code :
Function GetFormByName(ByVal FormName As String) As Form Dim Fullname As String = Application.ProductName & "." & FormName Return Activator.CreateInstance(Type.GetType(Fullname, True, True)) End Function Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click dim MyForm as new form MyForm = GetFormByName("<formname>") dim Mybutton as new button Mybutton = Myform.control("<buttonname>") Mybutton .visible = false
thanks in advance