vb.net - Adding Excel Object Library conflicts between Excel.TextBox & Forms.TextBox in Office Development -
i have implemented several basic excel functions in vb.net application (opening xls workbook & accessing worksheet). however, appears when add reference "microsoft excel 14.0 object library" application getting confused standard system.windows.forms objects , has following error: invalidcastexception occured: unable cast object of type 'system.windows.forms.textbox' type 'microsoft.office.interop.excel.textbox'. invalid cast error happening when calling subroutine & passing application form controls (check boxes, gridview, textbox, etc) main "form1" class utilityfunction module. utilityfunction has reusable windows registry sub routine retrieves/saves values @ application startup/closing. worked in past, crashing @ subroutine call in form1 class. exception occurs during application runtime, not during compile/build.
also, deleted text controls form , created them manually, i'm still getting same exception error.
when have namespace conflict need qualify object want.
dim exceltb new microsoft.office.interop.excel.textbox dim formtb new system.windows.forms.textbox
Comments
Post a Comment