Stupid C# question Please help!

  • Thread starter Thread starter Will
  • Start date Start date
W

Will

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.
 
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 ?????
 
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....
 
the OpenFileDialog class is member of System.Windows.Forms namespace, therefore you cannot use this in asp.net directly.....
 
Back
Top