שתף באמצעות


BC30451 Visual Basic AND VB.NET 'Result' is not declared. It may be inaccessible due to its protection level.

Question

Tuesday, August 2, 2016 11:07 AM

What does BC30451 Visual Basic AND  VB.NET 'Result' is not declared. It may be inaccessible due to its protection level mean?

Any good free websites to learn visual basic from?

All replies (4)

Tuesday, August 2, 2016 11:39 AM ✅Answered | 1 vote

Hello,

It's recommended when you have an issues to post the offending code as just stating an error message does not give context. An educated guess might be you declared a variable in one method or another class or code module which is local to that method and attempted to use it in another method, class or code module.

Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
VB Forums - moderator


Tuesday, August 2, 2016 11:24 AM

https://msdn.microsoft.com/en-us/library/d3xk5aeb.aspx

The same site is the reference for all Microsoft development tools

Success
Cor


Sunday, August 11, 2019 11:18 AM

I am having the same issue and I have included my code:

 Public Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        TxtResult.Text = 0
        Dim result As Integer = 0
        Dim prevresult As Integer = 0

        Dim action As String = ""

    End Sub
    Public Sub BtnZero_Click(sender As Object, e As EventArgs) Handles BtnZero.Click
        result = 0
        prevresult = 0

    End Sub

Both "result" and "prevresult" are found to be not declared in the above code. 

its just me, so open the door


Saturday, January 4, 2020 12:45 AM

Hi,

Firstly, Cor's solution doesn't work.

I have the same error.

How to reproduce the error:

Open Visual Studio 2019 (16.4.2)

New | Project

Choose ASP.NET Web Application (.NET Framework)  from Visual Basic / Windows / Web projects

Click Next

Name it or use the default name (WebApplication1) and make sure place solution in the same directory is ticked and I am targetting Framework 4.8

Click Create

Choose Empty project and tick Web Forms on the right and untick configure for HTTPS (my HTTPS is configured for a site on the Internet already

Click Create again

It opens to the Overview page

Add a Masterpage

Add a new Web Form with Master, drag any control to the form (Example TextBox and rename from TextBox1 to txtExample) between the two divs.

Press F7 to switch to code view

In Page_Load event

txtExample.Text = "This is some example text"

and you will see the BC30451 error reported by the OP.

Extra Info:

I added Bootstrap 4.3.1, FontAwesome 4.7, JQuery before coding any Master HTML.

I am using IIS 10 not Express

If I create a new Win Forms project (not an empty project (use the default Microsoft Bootstrap site)), drag a control, rename, click F7 and put simple code in Form_Load (txtExample.Text="Test") providing it matches the ID of the control and all if fine with it recognising the control.

If, I create a project like in the steps above, add a Web Form to the empty project without a Master page and then add a control to the form as above then the BC30451 error doesn't appear as it sees the control.

One more question with the same project.

I open the project from IIS 10, go to build and it constantly asks me to save the solution it's in a different directory

Example:

F:\MyWebProjects\WebApplication1

App is running in IIS10 via localhost without SSL

It asks to save the solution:

F:\MyWebProjects\localhost\localhost.sln

If I then choose F:\MyWebProjects\WebApplication1.sln and asking if I wish to overwrite it, it will not ask me to save the solution again until the next time I open the project. When you are asked daily, it's annoying

Any ideas?