Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4027008
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:02:36+00:00 2026-05-20T11:02:36+00:00

I’m converting a bunch of foxweb programs to asp.net. Some of the functions I

  • 0

I’m converting a bunch of foxweb programs to asp.net. Some of the functions I invoke in the asp code use “external functions,” by which I mean functions that I have defined in .vb files. For example, FileExists() is a nice function I would like to pull out into a common thing called clsCommon.vb .

I have implemented it like this:

Option Explicit On 
Option Strict On

Imports System
Imports System.Web.UI
Imports System.Web.UI.Page

Public Class clsCommon
    Inherits Page

    Public Shared Function FileExists(ByVal filename As String) As Boolean
        If Dir$(filename) <> "" Then
            Return True
        Else
            Return False
        End If
    End Function

End Class

I have tried using both DIR$() and DIR(). In each case, the error returned on the web page reads:

Compiler Error Message: BC30451: Name ‘Dir’ is not declared.

As with other functions I have written I invoke FileExists() something like this:

<%@ page  Debug="true" inherits="clsCommon" src="clsCommon.vb" %>
<%

Dim filename as String = "example.txt"

If clsCommon.FileExists(filename) then
  Response.Write(filename & " Exists")
else
  Response.Write(filename & " does not Exist")
end if

%>

Note 1: While I want to solve this specific problem, what I’m really looking for is the general way to get to these functions like DIR(), CHR(), etc., that I have come to rely on in VB.

Note 2: asp seems to only look at the vb text file – and not at the compiled dll file, so I don’t think the references I use have any effect on it.

Anyone see what I’m missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:02:36+00:00Added an answer on May 20, 2026 at 11:02 am

    TheGeekYouNeed is certainly right. The best approach is to either keep your code in VB (if it ain’t broke, don’t fix it) or consider investing some time in learning .Net

    I have seen code conversion tools for turning VB code into VB.Net. I can’t imagine them working for non-trivial projects though. Likewise, you can go out of your way to keep your code as ‘VB like’ as possible, but I think it’s like burning down your house to avoid having to sweep the floor.

    Anyway, the DIR function does still exist in the Microsoft.VisualBasic namespace.
    http://msdn.microsoft.com/en-us/library/dk008ty4(v=vs.71).aspx

    The more generally accepted way of doing this in .NET would be to use File.Exists
    http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I have just tried to save a simple *.rtf file with some websites and
I am confused How to use looping for Json response Array in another Array.
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have this code to decode numeric html entities to the UTF8 equivalent character.
I want use html5's new tag to play a wav file (currently only supported
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.