Results 1 to 2 of 2

Thread: File Upload applet in Karl Moore's VB.net Tutorial

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    1

    File Upload applet in Karl Moore's VB.net Tutorial

    I am trying to get the file upload application described on pages 284-285 in Karl Moore's Visual Basic.Net The Tutorials to work.
    At first I was getting the error message: The base class included the filed Form1 but its type (System.WebUI.HtmlControl.HtmlInputFile is not compatible with the type of control (System.Web.UI.HtmlControls.Htmlform.
    I finally fixed that and now I'm getting:

    Object variable or With block variable not set.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object variable or With block variable not set.
    Source Error:
    Line 21: 'Put user code to initialize the page here
    Line 22: Dim NameOfFieldFieldElement
    Line 23: NameOfFieldFieldElement.Posted.SaveAs(MyFile.PostedFIle.FileName)
    Line 24: End Sub

    The HTML in webform.aspx is:

    <form id="Form1" method="post" encTYpe="multipart/form-data" runat="server">
    <INPUT id="filename1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" type="file" name="filename1" runat="server">&nbsp;
    </form>

  2. #2
    Hyperactive Member MarkusJ_NZ's Avatar
    Join Date
    Jun 2001
    Posts
    375
    Try declaring NameOfFieldFieldElement as an object

    The error "System.NullReferenceException: Object variable or With block variable not set" usually means that the variable is not set to anything....

    Cheers
    MarkusJ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width