|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
option strict?Am 03.06.2010 14:29, schrieb Andy B.:
> What exactly does option strict do and what is the best setting for it? Serious question? Did you read Cor's message? ;)With Option Strict Off you can write Dim i As Integer = "wrong setting for option strict" and the compiler does not even complain. Does this make sense? No. With Option Strict Off, additional code to convert data is created. The problem is that one doesn't have an overview of where such conversions are created. Consequently you don't know if all conversions are intended. Consequently you don't know if all conversions will always succeed and will be done in the intended way. Consequently you are creating a time bomb. With Option Strict Off you enable late binding: Dim o As Object '... Debug.Print(o.ToStrig) You see the fault? The compiler doesn't! Checks are turned off or postponed to run time. There are few situations where late binding is required, but that's (usually) not daily business. Can be useful for Office automation. Questions answered? First thing done here after installation is changing the project defaults options to Option Strict On. It's a shame for MSFT they don't set it by default (once again in VB 2010 IIRC). It's just an additional potential risk. -- Armin have a look at this
http://msdn.microsoft.com/en-us/library/zcd4xwzs%28VS.80%29.aspx Show quoteHide quote "Andy B." <a_bo***@sbcglobal.net> wrote in message news:e$omehxALHA.348@TK2MSFTNGP06.phx.gbl... > What exactly does option strict do and what is the best setting for it? >
Good bye...
Binding to a column that is integer. Help converting a vb6 function to vbnet. Enable Visual Styles after application has started Calling unmanaged C dll from managed code Direct Client Requirement - Software Engineer (.Net) - VA - Chantilly (GC and Citizen may only apply vb.net congiguration settings vb.net share data Passing Values between forms Add new event manually to a control of mine. |
|||||||||||||||||||||||