hi all, i've got a problem here whereby my ctype doesn't work.
firstly, to replicate my case briefly, i've created an extension of control class
and i have this function that doesn't workCode:<extension()> public function getheight(byref control as Control) as integer return control.height end function
of course if i dim father as Control it works perfectly, but in my case father may be other objects as well that aren't controls so I had to dim father as a general object, is there a fix so i could properly convert father into a Control object?Code:public sub dostuff(byref control as Control) dim father as object father = ctype(control.parent, Control) father.getheight 'compiler writes: Panel class doesn't support getheight, but I've already converted it to a Control with CType! end sub




Reply With Quote