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
    Loop
 
End Sub

Tags:

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=2.0.0.0, 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.

Tags:

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

Tags:

WPF

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

Tags:

WPF

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

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

E-mail me Send mail

Calendar

<<  November 2017  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Recent comments

Tags

Disclaimer

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

© Copyright 2017

Sign in