Stupid C# question Please help!

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Stupid C# question Please help!

    I'm used to writing my code in VBscript but I have to do
    this project in C#. I've written some functions on my
    ASP.Net page and I'm getting an error that a namespace I
    need access to has not been imported. Normally I would do
    that through an Import Page Directive, but that doesn't
    work with C#.

    Can someone tell me how to include the System.IO Namespace
    on my ASP.Net page using C#? I know if I was putting it in
    a code-behind file or an assembly file I would just say:

    using System.IO;

    But that doesn't work in my .aspx page no matter where I
    place it in the code. Please help.
    Will Guest

  2. Similar Questions and Discussions

    1. Stupid question.
      I've worked with cfdirectory in the past but it mainly within the scope of deleting/creating a directory or get the name of files within a specific...
    2. Stupid Question??
      I have written a class to be used by asp.net applications that provides a useful function. Other than the constructor, it has just one method. ...
    3. OK. I'm asking a stupid question
      I created a multi-frame movie to use as my website. It has five buttons on it which I added the Get URL action to. When I publish it, and then open...
    4. a stupid question
      how to check the filetype of remote file because is_dir(), is_file() can't work on remote file thx a lot
    5. Is this a stupid question?
      I'm looking for the command to direct a user to a new URL. For example, in ASP, when you created a dropdown box, the item selected could open a...
  3. #2

    Default Re: Stupid C# question Please help!


    by default, the System.IO namespace is automacally imported in your ..aspx.. you don't need imported it....

    what error specifically asp.net shows you ?????

    "Will" <wswelch@comcast.net> wrote in message news:026201c35df5$18075410$a601280a@phx.gbl...
    > I'm used to writing my code in VBscript but I have to do
    > this project in C#. I've written some functions on my
    > ASP.Net page and I'm getting an error that a namespace I
    > need access to has not been imported. Normally I would do
    > that through an Import Page Directive, but that doesn't
    > work with C#.
    >
    > Can someone tell me how to include the System.IO Namespace
    > on my ASP.Net page using C#? I know if I was putting it in
    > a code-behind file or an assembly file I would just say:
    >
    > using System.IO;
    >
    > But that doesn't work in my .aspx page no matter where I
    > place it in the code. Please help.
    carlos medina Guest

  4. #3

    Default Re: Stupid C# question Please help!

    The error is as follows:

    Compiler Error Message: CS0246: The type or namespace
    name 'OpenFileDialog' could not be found (are you missing
    a using directive or an assembly reference?)

    The function it is refering to is as follows:

    void openDialog(Object sender, EventArgs e)
    {
    OpenFileDialog fd_Browse = new OpenFileDialog();
    fd_Browse.Title = "Scrapbook Image";
    fd_Browse.InitialDirectory = @"c:\";
    fd_Browse.Filter = "Image Files(*.BMP;*.JPG;*.GIF)
    |*.BMP;*.JPG;*.GIF|All files (*.*)|*.*";
    fd_Browse.FilterIndex = 2;
    fd_Browse.RestoreDirectory = true;

    if(fd_Browse.ShowDialog() == DialogResult.OK)
    {
    tb_ImageFile.Text = fd_Browse.FileName;
    }
    }



    >-----Original Message-----
    >
    >by default, the System.IO namespace is automacally
    imported in your ..aspx.. you don't need imported it....
    >
    >what error specifically asp.net shows you ?????
    >
    >"Will" <wswelch@comcast.net> wrote in message
    news:026201c35df5$18075410$a601280a@phx.gbl...
    >> I'm used to writing my code in VBscript but I have to
    do
    >> this project in C#. I've written some functions on my
    >> ASP.Net page and I'm getting an error that a namespace
    I
    >> need access to has not been imported. Normally I would
    do
    >> that through an Import Page Directive, but that doesn't
    >> work with C#.
    >>
    >> Can someone tell me how to include the System.IO
    Namespace
    >> on my ASP.Net page using C#? I know if I was putting it
    in
    >> a code-behind file or an assembly file I would just say:
    >>
    >> using System.IO;
    >>
    >> But that doesn't work in my .aspx page no matter where
    I
    >> place it in the code. Please help.
    Will Guest

  5. #4

    Default Re: Stupid C# question Please help!


    the OpenFileDialog class is member of System.Windows.Forms namespace, therefore you cannot use this in asp.net directly.....



    "Will" <wswelch@comcast.net> wrote in message news:039701c35e10$0008cbd0$a501280a@phx.gbl...
    > The error is as follows:
    >
    > Compiler Error Message: CS0246: The type or namespace
    > name 'OpenFileDialog' could not be found (are you missing
    > a using directive or an assembly reference?)
    >
    > The function it is refering to is as follows:
    >
    > void openDialog(Object sender, EventArgs e)
    > {
    > OpenFileDialog fd_Browse = new OpenFileDialog();
    > fd_Browse.Title = "Scrapbook Image";
    > fd_Browse.InitialDirectory = @"c:\";
    > fd_Browse.Filter = "Image Files(*.BMP;*.JPG;*.GIF)
    > |*.BMP;*.JPG;*.GIF|All files (*.*)|*.*";
    > fd_Browse.FilterIndex = 2;
    > fd_Browse.RestoreDirectory = true;
    >
    > if(fd_Browse.ShowDialog() == DialogResult.OK)
    > {
    > tb_ImageFile.Text = fd_Browse.FileName;
    > }
    > }
    >
    >
    >
    >
    > >-----Original Message-----
    > >
    > >by default, the System.IO namespace is automacally
    > imported in your ..aspx.. you don't need imported it....
    > >
    > >what error specifically asp.net shows you ?????
    > >
    > >"Will" <wswelch@comcast.net> wrote in message
    > news:026201c35df5$18075410$a601280a@phx.gbl...
    > >> I'm used to writing my code in VBscript but I have to
    > do
    > >> this project in C#. I've written some functions on my
    > >> ASP.Net page and I'm getting an error that a namespace
    > I
    > >> need access to has not been imported. Normally I would
    > do
    > >> that through an Import Page Directive, but that doesn't
    > >> work with C#.
    > >>
    > >> Can someone tell me how to include the System.IO
    > Namespace
    > >> on my ASP.Net page using C#? I know if I was putting it
    > in
    > >> a code-behind file or an assembly file I would just say:
    > >>
    > >> using System.IO;
    > >>
    > >> But that doesn't work in my .aspx page no matter where
    > I
    > >> place it in the code. Please help.
    carlos medina Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139