Value cannot be null. Parameter name: stream

Posted on 2006-03-24
Last Modified: 2007-11-27
Value cannot be null.
Parameter name: stream

I'm not sure how to resolve this.  I have referenced filefs but before this was working fine:

            Dim file As New IO.FileInfo(sIncomingfile)
            Dim filefs As IO.FileStream = Nothing
            Dim reader As New IO.StreamReader(filefs)  <-------- Problem is that it doesn't like Nothing
Question by:dba123
    LVL 21

    Accepted Solution

    There's no constructor that takes a filestream.  Maybe something like this:

    Dim file As New IO.FileInfo(sIncomingfile)
    Dim reader As IO.StreamReader = file.OpenText()
    LVL 1

    Author Comment

    I got it, I must have changed something...

                Dim file As New IO.FileInfo(sIncomingfile)
                Dim filefs As New IO.FileStream(file.FullName, IO.FileMode.Open)
    LVL 1

    Author Comment

    your version also worked so I'll reward the points.  Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now