From: mp on 25 Apr 2010 14:23 Should that be on or off? (i know, dumb question) I'd assume on, but then so many things break looks like it will take long time to rewrite existing prog. example: Option Strict On disallows implicit conversions from 'Object' to 'Autodesk.AutoCAD.Interop.AcadApplication'. but the variable wasn't declared as Object it was early bound Private m_AcadApp As AcadApplication = Nothing ....then later Private Function GetAutoCADInstance() As AcadApplication Try m_AcadApp = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication Catch ex As Exception End Try Return m_AcadApp End Function sorry but i don't see the implicit conversion thanks for any info mark
From: Armin Zingler on 25 Apr 2010 14:58 Am 25.04.2010 20:23, schrieb mp: > Should that be on or off? (i know, dumb question) > I'd assume on, but then so many things break looks like it will take long > time to rewrite existing prog. Always fasten your seat belt. But AFAIK, here in Germany, taxi drivers are allowed to drive without it if they are transporting a passenger. So, this strict rule has an exception. Still I say: Always fasten seat belt. > example: > Option Strict On disallows implicit conversions from 'Object' to > 'Autodesk.AutoCAD.Interop.AcadApplication'. > but the variable wasn't declared as Object it was early bound > Private m_AcadApp As AcadApplication = Nothing > > ....then later > > Private Function GetAutoCADInstance() As AcadApplication > Try > m_AcadApp = > Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication > Catch ex As Exception > End Try > Return m_AcadApp > End Function > > > > sorry but i don't see the implicit conversion What is the type of 'AcadApplication'? If it's 'Object', it could be of any type. Did you consider this? Are you sure that 'AcadApplication' will _always_ be of type Autodesk.AutoCAD.Interop.AcadApplication? If you are, then cast the object to that type before the assignment. -- Armin
From: mp on 25 Apr 2010 16:38 "Armin Zingler" <az.nospam(a)freenet.de> wrote in message news:e$uv7lK5KHA.4740(a)TK2MSFTNGP06.phx.gbl... > Am 25.04.2010 20:23, schrieb mp: >> Should that be on or off? (i know, dumb question) >> I'd assume on, but then so many things break looks like it will take long >> time to rewrite existing prog. > > Always fasten your seat belt. But AFAIK, here in Germany, taxi drivers > are allowed to drive without it if they are transporting a passenger. > So, this strict rule has an exception. Still I say: Always fasten seat > belt. > >> example: >> Option Strict On disallows implicit conversions from 'Object' to >> 'Autodesk.AutoCAD.Interop.AcadApplication'. >> but the variable wasn't declared as Object it was early bound >> v>> >> ....then later >> >> Private Function GetAutoCADInstance() As AcadApplication >> Try >> m_AcadApp = >> Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication >> Catch ex As Exception >> End Try >> Return m_AcadApp >> End Function >> >> >> >> sorry but i don't see the implicit conversion > > What is the type of 'AcadApplication'? If it's 'Object', it could > be of any type. Did you consider this? Are you sure that 'AcadApplication' > will _always_ be of type Autodesk.AutoCAD.Interop.AcadApplication? > If you are, then cast the object to that type before the assignment. > > > -- > Armin oh, i think i see what you mean... i should have had Private m_AcadApp as Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication = Nothing instead of... Private m_AcadApp As AcadApplication = Nothing ....is that what you mean? thanks mark
From: Herfried K. Wagner [MVP] on 25 Apr 2010 17:41 Am 25.04.2010 22:38, schrieb mp: >>> Option Strict On disallows implicit conversions from 'Object' to >>> 'Autodesk.AutoCAD.Interop.AcadApplication'. >>> but the variable wasn't declared as Object it was early bound >>> v>> >>> ....then later >>> >>> Private Function GetAutoCADInstance() As AcadApplication >>> Try >>> m_AcadApp = >>> Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication >>> Catch ex As Exception >>> End Try >>> Return m_AcadApp >>> End Function >>> >>> >>> >>> sorry but i don't see the implicit conversion >> >> What is the type of 'AcadApplication'? If it's 'Object', it could >> be of any type. Did you consider this? Are you sure that 'AcadApplication' >> will _always_ be of type Autodesk.AutoCAD.Interop.AcadApplication? >> If you are, then cast the object to that type before the assignment. >> >> >> -- >> Armin > > oh, i think i see what you mean... > i should have had > Private m_AcadApp as > Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication = Nothing > instead of... > Private m_AcadApp As AcadApplication = Nothing > ...is that what you mean? Not really. The type of the 'Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication' property (as I assume) should not be 'Object'. However, maybe this is out of your control. In this case, read the documentation on the property carefully. Maybe a cast ('DirectCast') is required to cast the returned value to 'AcadApplication'. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
From: mp on 25 Apr 2010 23:57 "Herfried K. Wagner [MVP]" <hirf-spam-me-here(a)gmx.at> wrote in message news:%23jZ4PAM5KHA.1888(a)TK2MSFTNGP05.phx.gbl... > Am 25.04.2010 22:38, schrieb mp: >>>> Option Strict On disallows implicit conversions from 'Object' to >>>> 'Autodesk.AutoCAD.Interop.AcadApplication'. >>>> but the variable wasn't declared as Object it was early bound >>>> v>> >>>> ....then later >>>> >>>> Private Function GetAutoCADInstance() As AcadApplication >>>> Try >>>> m_AcadApp = >>>> Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication >>>> Catch ex As Exception >>>> End Try >>>> Return m_AcadApp >>>> End Function >>>> >>>> >>>> >>>> sorry but i don't see the implicit conversion >>> >>> What is the type of 'AcadApplication'? If it's 'Object', it could >>> be of any type. Did you consider this? Are you sure that >>> 'AcadApplication' >>> will _always_ be of type Autodesk.AutoCAD.Interop.AcadApplication? >>> If you are, then cast the object to that type before the assignment. >>> >>> >>> -- >>> Armin >> >> oh, i think i see what you mean... >> i should have had >> Private m_AcadApp as >> Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication = >> Nothing >> instead of... >> Private m_AcadApp As AcadApplication = Nothing >> ...is that what you mean? > > Not really. > > The type of the > 'Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication' > property (as I assume) should not be 'Object'. However, maybe this is out > of your control. In this case, read the documentation on the property > carefully. Maybe a cast ('DirectCast') is required to cast the returned > value to 'AcadApplication'. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Thanks, I'll check it out mark
|
Pages: 1 Prev: after debug "Can't write dll because a process has it open" Next: form inheritence |