Results 1 to 5 of 5

Thread: [RESOLVED] VB Defaults

  1. #1

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,786

    Resolved [RESOLVED] VB Defaults

    My defaults are set to Infer Off, Strict and Explicit On.

    I create a windows forms app in VS2022. It is .Net 8.

    The form has a button and a textbox and this code shows no errors and runs.

    Code:
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            TextBox1.Text = 1 / 2
            ' TextBox1.Text  has 0.5
        End Sub
    End Class
    What?

    edit:

    If I declare the options in the form then I get errors.

    Option Strict On : Option Explicit On : Option Infer Off

    If I create a Windows Forms App (.Net Framework) then I get the appropriate errors.
    Last edited by dbasnett; Jun 14th, 2024 at 11:40 AM.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,602

    Re: VB Defaults

    It looks like .NET Core projects don't respect the VB defaults in the VS options. I just set my defaults the same as yours:

    Infer Off
    Strict On
    Explicit On

    When I looked at the project properties, I saw this:

    Infer On
    Strict Off
    Explicit On

    Looks like Option Strict On will have to be set at the project level. I think that's something to report to Microsoft.

  3. #3

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,786

    Re: VB Defaults

    Quote Originally Posted by jmcilhinney View Post
    ... I think that's something to report to Microsoft.
    Thanks for confirming. I've never reported anything to MS. Any guidance?
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,602

    Re: [RESOLVED] VB Defaults

    In VS, select Help -> Send Feedback -> Report a Problem and fill out the form in your browser. Search for similar reports first. Provide as much relevant info as possible, including step-by-step instructions on how to reproduce the issue, what you expect to happen and what actually happens. I'd include screenshots of your Options dialogue and the properties of new .NET Framework and .NET projects. You should also include your OS and VS version numbers.

  5. #5

    Thread Starter
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,786

    Re: [RESOLVED] VB Defaults

    Thanks.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width