Stupid C# question Please help!

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.
 
C

carlos medina

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 ?????
 
W

Will

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....
 
C

carlos medina

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top