nOObish question here about Visual Studio

Ok I'm using Visual Web Developer 2008 express.

I'd like to be able to write a class to handle the job of grabbing all the files in a folder, stuffing them into an array, creating thumbnails, putting them in the ImageUrl for the various places on the page... etc etc.

Problem is I have two different pages that do the same thing with two different folders.

I want to be able to encapsulate these tasks into a single class... that way I can write the page_load method to create this object and do all that stuff automatically by passing a few parameters to it.

HERE'S the NOOb QUESTION:::

How the f... do I do that and where the f... fo I put it? I tried calling all these methods from the second page but it doesn't exist in that context. I tried putting them all in the masterpage, but that doesn't work either. Why can't I create user-defined classes that I can instantiate as easily as I can the pre-defined classes of the .NET framework? I thought this was the whole point behind OOP...

Comments

  • Once again responding to my own questions...

    If anyone else has the same question, here's how you do it:

    Once you create your website, you go to file > new file at the top and create a new "class" file.

    That's it. You can reference this class throughout your numerous codebehind files.
  • hehe - yes, the Class is one of the foundations of Object Oriented Programming.

    There are millions of tutorials and a life-time worth of material on OOP on the net that you might be interested in.

    One of the biggest improvements the Class will give your code is re-usability. You should try to "objectify" everything you can to make your overall code as small as possible.

    ><//~Psightoplasm`~
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories