Opening and Reading files with VBA

by ebarcza 5/23/2012 8:32:00 AM
Sub ReadFile()
    Dim FSO As New FileSystemObject
    Dim FS
    Set FS = FSO.OpenTextFile("c:\textfile.TXT")
    Do Until FS.AtEndOfStream
        sText = FS.ReadLine
        Debug.Print MyChar
End Sub


File Does Not Exist. System.IO.FileInfo GetFileInfo(System.String, System.String, System.Web.HttpResponse)

by rbellantoni 5/18/2012 5:25:00 AM

If you're getting this frustrating error in the application error event in the global.asax file and it looks like this:


12/12/2012 14:49:23
Type : System.Web.HttpException, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Message : File does not exist.
Source : System.Web
Help link : 
ErrorCode : -2147467259
Data : System.Collections.ListDictionaryInternal
TargetSite : System.IO.FileInfo GetFileInfo(System.String, System.String, System.Web.HttpResponse)
Stack Trace :    at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
   at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context)
   at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The cause of this is because there is a file missing somewhere either an image file or some other referenced file. Now normally this would not throw an error, but the issue seems to appear due to a bad AppRelative path. You check to see what file/image is missing by drilling down into System.Web.HttpContext.Current.Request and looking at the AppRelativeCurrentExecutionFilePath when inside of the application error event to find out what file is missing. There you will see the bad relative path as well as the file it's looking for. Normally it wouldn't throw an error by having a missing image or referenced file path, but because its a relative path and the property is server side it throws a server level error.


WPF Application ICON

by ebarcza 5/17/2012 5:38:00 AM

To Add a custom ICON to your WPF application:

  1. right click on the project name in the solution explorer.
  2. Go to the Application tab, this should be the first one in Visual Studioj 2008
  3. In this tab you can set the icon.


Please note that the icon sometimes will not show up when you are in debug mode. Run without debugging and BOOM - you have an Application ICON



WPF Multi line textbox

by ebarcza 5/3/2012 5:09:00 AM

To make a textbox multiline in WPF you have to set these 3 properties of TextBox Control.

  1. TextWrapping="Wrap"
  2. VerticalScrollBarVisibility="Visible"
  3. AcceptsReturn="True"

BOOM -> multi-line



Powered by BlogEngine.NET
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail


<<  September 2022  >>

View posts in large calendar

Recent comments



The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2022

Sign in