locked
BC30451: Name 'Mystyle' is not declared RRS feed

  • Question

  • User-852894958 posted

    Hi Friends,

    I have created class file with name Mystyle and the code is as follows

    Imports Microsoft.VisualBasic
    Public Class Mystyle
        Public Shared Function Msg() As String
            Dim st As String
            st = "Hi boss How r u"
            Return st
        End Function
    End Class

    I am calling this as Response.Write(mystyle.Msg())

    This is working fine in my local system fine but I am getting the below error in the development server.

    Compiler Error Message: BC30451: Name 'Mystyle' is not declared.

    Source Error:

    Line 7:              Response.Write(Mystyle.Msg())

    Can any one help me?

     

    Thanks,

    Farooq

    Monday, June 29, 2009 6:22 AM

Answers

  • User-1247439580 posted

    I just ran into the same problem.

    I solved it by going into IIS on my dev machine and converting my virtual directory to an application.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 31, 2009 8:26 PM
  • User2019981500 posted

    Hi

    I agree with rpayne7264.

    This can be one the reason.

    Regards

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 22, 2011 2:49 AM

All replies

  • User2019981500 posted

    Hey,

     

    Just check where you have kept your class file,better put this class in App_Code Folder.

    if still it would't work just recompile it

     

    Regards

    hakim,

     

     

    Monday, June 29, 2009 9:24 AM
  • User-852894958 posted

    Thanks for the reply hakim!

    Yes the class file is in App_code folder.

    I created a new page and built the solution and got the output in my local system as Hi boss How r u

    I uploaded the bin file, class file and newly created page.

    Again I am getting the above specified error in the development server.

    Need help and suggestions

    Thanks,

    Farooq

    Monday, June 29, 2009 11:54 PM
  • User-852894958 posted

    Need help,

     

    Thanks,

    Farooq

    Tuesday, June 30, 2009 11:05 PM
  • User2019981500 posted

     

    hey ,

    • A common cause is a simple misspelling where the class name is used. For example:
    dim connection as OdbcConection;

    Here the class name should have been 'OdbcConnection'. The solution is to correct the spelling.

    • If the name is correct then the next most likely cause is that the required namespace has not been imported. For example:
    dim connection as OdbcConnection;
    .
    .
    [Error] Type 'OdbcConnection' is not defined.

    In this example 'OdbcConnection' is defined in the namespace 'System.Data.Odbc' (although this differs been the .Net framework 1.0 and later versions). Try importing the necessary namespace, so in this case:

    VB.NET: Imports System.Data.Odbc
    C#: using System.Data.Odbc;

    "imports" (or "using") statement must be included at the very top of the file.

    Just Observe properly whether things are going

    Wednesday, July 1, 2009 1:44 AM
  • User-852894958 posted

    Thanks for the reply Hakim!

    Let me tell you that Mystyle class doesn’t have any namespace and it contains only the simple logic, you can refer above code.

    I am calling the class fuction like this lblMessage.Text = Mystyle.Msg

    Mystyle is the class file name and Msg is the function, I checked and the names are same.

    I don’t understand why the problem is in development server only.

     

    Thanks,

    Farooq

    Wednesday, July 1, 2009 2:08 AM
  • User-1247439580 posted

    I just ran into the same problem.

    I solved it by going into IIS on my dev machine and converting my virtual directory to an application.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 31, 2009 8:26 PM
  • User2019981500 posted

    Hi

    I agree with rpayne7264.

    This can be one the reason.

    Regards

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 22, 2011 2:49 AM