Results 1 to 7 of 7

Thread: [RESOLVED] Overload resolution failed because no accessible 'New' can be called without a narrow

  1. #1
    Fanatic Member davebat's Avatar
    Join Date
    Dec 02
    Posts
    727

    Resolved [RESOLVED] Overload resolution failed because no accessible 'New' can be called without a narrow

    Im working on a really old site and the following line is causing an error

    Code:
             
    Dim newFile As FileStream = New FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create, System.IO.FileShare.ReadWrite)
    Any ideas how to correct this issue

  2. #2
    Fanatic Member
    Join Date
    Jun 04
    Location
    All useless places
    Posts
    916

    Re: Overload resolution failed because no accessible 'New' can be called without a na

    Not completely sure if it will help but worth a try (unfamiliar with vb.net)
    Code:
    Dim newFile As New FileStream(Server.MapPath(sSavePath + sFilename), System.IO.FileMode.Create, System.IO.FileShare.ReadWrite)

  3. #3
    Fanatic Member davebat's Avatar
    Join Date
    Dec 02
    Posts
    727

    Re: Overload resolution failed because no accessible 'New' can be called without a na

    exactly the same error, but thanks for trying. Unfortuantely I never properly learnt any programming so have no idea about the diffeerence between new and = etc

  4. #4
    Fanatic Member davebat's Avatar
    Join Date
    Dec 02
    Posts
    727

    Re: Overload resolution failed because no accessible 'New' can be called without a na

    sorted, i changed too

    Code:
         Dim filepath As String = (Server.MapPath(sSavePath & sFilename))
              Dim newFile As FileStream
              newFile = New FileStream(filepath, FileMode.Append)

  5. #5
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 04
    Location
    The Granite City
    Posts
    21,729

    Re: [RESOLVED] Overload resolution failed because no accessible 'New' can be called w

    Out of interest, what was the exception that you were seeing?

    Gary

  6. #6
    Fanatic Member davebat's Avatar
    Join Date
    Dec 02
    Posts
    727

    Re: [RESOLVED] Overload resolution failed because no accessible 'New' can be called w

    Overload resolution failed because no accessible 'New' can be called without a narrow

  7. #7
    Fanatic Member
    Join Date
    Jun 04
    Location
    All useless places
    Posts
    916

    Re: [RESOLVED] Overload resolution failed because no accessible 'New' can be called w

    Although error message is partially posted here, I assumed it was "Overload resolution failed because no accessible '<method>' can be called without a narrowing conversion: <error>:"

    Got the reference at MSDN: http://msdn.microsoft.com/en-us/libr...(v=VS.90).aspx

    Since I do not know VB much, I am not sure if assigning a new instance varies on where it is done. I also miss out on "+" and "&" for string concatenation (I thought they were same).

Posting Permissions

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