locked
hides inside block RRS feed

  • Question

    • Select Case PCategory
      Case "General"

      Dim filepathCat As String = HttpContext.Current.Server.MapPath("/ImagesProjectsSection/6001/")
      Dim dir2 As New DirectoryInfo(filepathCat)
      Dim FilesInfo2 As FileInfo() = direct1.GetFiles("Logo-*")
      If FilesInfo2.Length > 0 Then
      For Each aFile As FileInfo In FilesInfo2
      CImageName = aFile.Name
      aFile.MoveTo(filepathCat & aFile.Name)

      Next
      End If

      Case "HealthCare"
      Dim filepathCat As String = HttpContext.Current.Server.MapPath("/ImagesProjectsSection/6002/")
      Dim dir2 As New DirectoryInfo(filepathCat)
      Dim FilesInfo2 As FileInfo() = direct1.GetFiles("Logo-*")
      If FilesInfo2.Length > 0 Then
      For Each aFile As FileInfo In FilesInfo2
      CImageName = aFile.Name
      aFile.MoveTo(filepathCat & aFile.Name)

      Next
      End If

      Dim dir2 As New DirectoryInfo(filepathCat) getting error hides inside block,plz help


    • Moved by Reed KimbleMVP Monday, July 2, 2012 4:07 PM asp.net (From:Visual Basic General)
    Monday, July 2, 2012 4:04 PM

Answers

  • This is ASP.Net code (server.mappath).

    Please use http://forums.asp.net for questions.

    Note that you cannot declare a variable with the same name in the same or an enclosing scope.  Move Dim dir2 As DirectoryInfo to the top, once, and then set dir2 = New DirectoryInfo(...) as needed.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    • Marked as answer by SSmadhu Tuesday, July 3, 2012 6:08 AM
    Monday, July 2, 2012 4:06 PM
  • cant use same varaible within same scope 

    rename it n it will works 

    thnx

    • Marked as answer by SSmadhu Tuesday, July 3, 2012 6:08 AM
    Tuesday, July 3, 2012 6:08 AM

All replies

  • This is ASP.Net code (server.mappath).

    Please use http://forums.asp.net for questions.

    Note that you cannot declare a variable with the same name in the same or an enclosing scope.  Move Dim dir2 As DirectoryInfo to the top, once, and then set dir2 = New DirectoryInfo(...) as needed.


    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    • Marked as answer by SSmadhu Tuesday, July 3, 2012 6:08 AM
    Monday, July 2, 2012 4:06 PM
  • cant use same varaible within same scope 

    rename it n it will works 

    thnx

    • Marked as answer by SSmadhu Tuesday, July 3, 2012 6:08 AM
    Tuesday, July 3, 2012 6:08 AM