M Mark Sargent Sep 2, 2003 #1 Can anyone tell me how to specify the "Option Strict" setting when generating code using the VBCodeProvider. Thanks.
Can anyone tell me how to specify the "Option Strict" setting when generating code using the VBCodeProvider. Thanks.
J Jay B. Harlow [MVP - Outlook] Sep 2, 2003 #2 Mark, You can set the option using a CodeGeneratorOptions object when you call ICodeGenerator.GenerateCode. Set the '/optionstrict' option to "+" Something like: Dim unit As CodeCompileUnit Dim output As StreamWriter Dim generator As ICodeGenerator Dim options as New CodeGeneratorOptions() options("/optionstrict") = "+" generator.GenerateCodeFromCompileUnit(unit, output, options) Hope this helps Jay
Mark, You can set the option using a CodeGeneratorOptions object when you call ICodeGenerator.GenerateCode. Set the '/optionstrict' option to "+" Something like: Dim unit As CodeCompileUnit Dim output As StreamWriter Dim generator As ICodeGenerator Dim options as New CodeGeneratorOptions() options("/optionstrict") = "+" generator.GenerateCodeFromCompileUnit(unit, output, options) Hope this helps Jay
J Jay B. Harlow [MVP - Outlook] Sep 3, 2003 #4 Mark, Doh! I was looking at the wrong part of the code :-| You need to add the following to the UserData of your CodeCompileUnit: Dim unit As CodeCompileUnit ' Option Strict On unit.UserData.Add("AllowLateBound", False) ' Option Explicit On unit.UserData.Add("RequireVariableDeclaration", True) The /optionstrict was something else I was trying, but never removed from my sample... :-( Hope this helps Jay
Mark, Doh! I was looking at the wrong part of the code :-| You need to add the following to the UserData of your CodeCompileUnit: Dim unit As CodeCompileUnit ' Option Strict On unit.UserData.Add("AllowLateBound", False) ' Option Explicit On unit.UserData.Add("RequireVariableDeclaration", True) The /optionstrict was something else I was trying, but never removed from my sample... :-( Hope this helps Jay
M Mark Sargent Sep 5, 2003 #5 Marvellous - works a treat. Thanks! Jay B. Harlow said: Mark, Doh! I was looking at the wrong part of the code :-| You need to add the following to the UserData of your CodeCompileUnit: Dim unit As CodeCompileUnit ' Option Strict On unit.UserData.Add("AllowLateBound", False) ' Option Explicit On unit.UserData.Add("RequireVariableDeclaration", True) The /optionstrict was something else I was trying, but never removed from my sample... :-( Hope this helps Jay Click to expand...
Marvellous - works a treat. Thanks! Jay B. Harlow said: Mark, Doh! I was looking at the wrong part of the code :-| You need to add the following to the UserData of your CodeCompileUnit: Dim unit As CodeCompileUnit ' Option Strict On unit.UserData.Add("AllowLateBound", False) ' Option Explicit On unit.UserData.Add("RequireVariableDeclaration", True) The /optionstrict was something else I was trying, but never removed from my sample... :-( Hope this helps Jay Click to expand...