473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How do I reference my new class?

I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

....

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.

Sep 15 '06 #1
9 1640
"using" in the context you are using it for is for including a namespace not
individual class names.

The codebehind is needed to tell the asp.net page where its code fine is,
put codebehind back.

So ref the class you do it as you would any class and your line of code is
correct. You would then use myFiler.someMethod() etc now that you have
created an instance of your class.

Make sense? What you written is all fine aside from the misuse of using and
the removal of codebehin, but you knew that broke it so not really sure why
or where you are stuck?

<ne***********@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
>I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

...

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.

Sep 15 '06 #2
If I use codebehind, which is for Visual Studio as I understand it,
then I require the DLL. I do not want to use the DLL. I want to use
the .cs source file, so I am using src=. I am not using VS at the
moment. That is why I took the codebehind out and now I can't
reference the class.
Daniel wrote:
"using" in the context you are using it for is for including a namespace not
individual class names.

The codebehind is needed to tell the asp.net page where its code fine is,
put codebehind back.

So ref the class you do it as you would any class and your line of code is
correct. You would then use myFiler.someMethod() etc now that you have
created an instance of your class.

Make sense? What you written is all fine aside from the misuse of using and
the removal of codebehin, but you knew that broke it so not really sure why
or where you are stuck?

<ne***********@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

...

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.
Sep 15 '06 #3
ne***********@gmail.com wrote:
If I use codebehind, which is for Visual Studio as I understand it,
then I require the DLL. I do not want to use the DLL.
[What do you mean here of the DLL ?? Visual Studio is just an IDE to
improve your efficiency, it will use the same way to compile the code as
you will use on the command line.]

I want to use
the .cs source file, so I am using src=. I am not using VS at the
moment. That is why I took the codebehind out and now I can't
reference the class.
Daniel wrote:
>"using" in the context you are using it for is for including a namespace not
individual class names.

The codebehind is needed to tell the asp.net page where its code fine is,
put codebehind back.

So ref the class you do it as you would any class and your line of code is
correct. You would then use myFiler.someMethod() etc now that you have
created an instance of your class.

Make sense? What you written is all fine aside from the misuse of using and
the removal of codebehin, but you knew that broke it so not really sure why
or where you are stuck?

<ne***********@gmail.comwrote in message
news:11**********************@d34g2000cwd.googleg roups.com...
>>I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

...

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.
Sep 15 '06 #4

Jianwei Sun wrote:
ne***********@gmail.com wrote:
If I use codebehind, which is for Visual Studio as I understand it,
then I require the DLL. I do not want to use the DLL.

[What do you mean here of the DLL ?? Visual Studio is just an IDE to
improve your efficiency, it will use the same way to compile the code as
you will use on the command line.]
If I use Visual Studio and build a web app. It creates a DLL in the
\bin directory. I do not want the DLL library. Instead, I just want
the asp.net c# page to use the src instead of codebehind.

Page1 up top, page directive, instead of codebehind="Page1.aspx.cs", I
have src="Page1.aspx.cs" The codebehind is for Visual Studio. Src is
for runtime to tell it to use the source code file (not the DLL). I
can change that and it will work fine src=works fine.

What I cannot do now is reference the classes that are not part of the
..cs file. They are class files outside of the .aspx.cs page. They are
standalone class files. I believe in Java all they had to do was be in
the same directory to be imported, but for some reason I cannot
reference them.

Sep 15 '06 #5
I suppose I can take the code out of my class and put it in each file
that needs it, but that is not the correct way to proceed, I am sure.
ne***********@gmail.com wrote:
I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

...

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.
Sep 15 '06 #6
Why are you so against using a dll? A dll is the way to go and is not a bad
thing. During development it will be a cs file once compiled a dll is
created but it is still, referencing inside the dll.

Use codebhind, and it works. Why you are so aginst this i do not know. You
are creating the problem here. Sounds like your stuck in java world which i
think is why your struggling. Unlearn what you have learnt ;) use codebhind,
dont question what workd and use the compiled dll. At deployment you will
never use a cs file.

If you can't take the advice, there is no use trying to help you further
'cause your gonan fight it and fight it and come back to this conclusion. If
you don't, then well, don't give up the day job.

And on another note. WHY are you using notepad? While your at it, turn off
your computer, get out a pen and paper. You seem to want to make simple
things complicated?

Seriously, think about it.
<ne***********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
>I suppose I can take the code out of my class and put it in each file
that needs it, but that is not the correct way to proceed, I am sure.
ne***********@gmail.com wrote:
>I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

...

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.

Sep 15 '06 #7
On 15 Sep 2006 11:18:45 -0700, ne***********@gmail.com wrote:
>I suppose I can take the code out of my class and put it in each file
that needs it, but that is not the correct way to proceed, I am sure.
ne***********@gmail.com wrote:
>I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

...

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.
You should change your email address. You're not processing the information
you're receiving.
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Sep 15 '06 #8
I do not understand the offence here. I merely asked a question to see
how it would work.

The advice, I understand, is free, and I respect that. But I simply
cannot use the dll. There are various reasons, but suffice it to say
that I cannot migrate my 1.1 server to 2.0 at this time. I cannot get
2005 to work right. I want to change one line of sql code to get a
query to work and I because I can't get eveything to compile into the
dll the way I normally do (notepad is fine for a single line of code
change). I wanted a workaround because I want everything to work. I
found that I could use the src directive and that this would do what I
needed until I can get everything working normally. It is not a
mattter of being argumentative, foolish, or just plain stupid. I need
to know. I can't always have everything working perfectly.

Yes, in Java the class can be referenced because it is in the same
directory. That is what I thought C# would allow. Apparently that is
wrong. That is why I asked the question. I would have thought this
would be a very basic question, but it appears to be a difficult one.
I simply want to instantiate a class that resides in a different file
than the cs source file of the aspx page. I thought it would be easy
for those who were more familar with the language and .net platform.

Don't get me wrong, I am thankful for any help, but I really don't get
the problem here. I have my reasons for asking the question. Under
normal circumstances I would proceed normally. I can't in this case.

Daniel wrote:
Why are you so against using a dll? A dll is the way to go and is not a bad
thing. During development it will be a cs file once compiled a dll is
created but it is still, referencing inside the dll.

Use codebhind, and it works. Why you are so aginst this i do not know. You
are creating the problem here. Sounds like your stuck in java world which i
think is why your struggling. Unlearn what you have learnt ;) use codebhind,
dont question what workd and use the compiled dll. At deployment you will
never use a cs file.

If you can't take the advice, there is no use trying to help you further
'cause your gonan fight it and fight it and come back to this conclusion. If
you don't, then well, don't give up the day job.

And on another note. WHY are you using notepad? While your at it, turn off
your computer, get out a pen and paper. You seem to want to make simple
things complicated?

Seriously, think about it.
<ne***********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googlegr oups.com...
I suppose I can take the code out of my class and put it in each file
that needs it, but that is not the correct way to proceed, I am sure.
ne***********@gmail.com wrote:
I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

...

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.
Sep 16 '06 #9
No one is offended, but your IGNORING the answer. Its like saying 1 + 1 what
does it equal? it seems to equal 2 but it cant do can someone help?

Then we all yell back IT DOES EQUAL 2....and you reply, but it can't.

Thats how it feels.

The fact you think you cannot use a dll as your server is on 1.1 of .net
shows some serious misunderstadning, form my experience the people that
question everything are the slowest to learn and your one of them.

I might edit one line of code, i'd still fire up visual studio so i can edit
and compile.

We have given you the answer.

Don't take this as insults towards you, this is constructive criticism. just
do it how it is supposed t be. your problems seem to be from a lack of
fundamental understanding here.

<ne***********@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
>I do not understand the offence here. I merely asked a question to see
how it would work.

The advice, I understand, is free, and I respect that. But I simply
cannot use the dll. There are various reasons, but suffice it to say
that I cannot migrate my 1.1 server to 2.0 at this time. I cannot get
2005 to work right. I want to change one line of sql code to get a
query to work and I because I can't get eveything to compile into the
dll the way I normally do (notepad is fine for a single line of code
change). I wanted a workaround because I want everything to work. I
found that I could use the src directive and that this would do what I
needed until I can get everything working normally. It is not a
mattter of being argumentative, foolish, or just plain stupid. I need
to know. I can't always have everything working perfectly.

Yes, in Java the class can be referenced because it is in the same
directory. That is what I thought C# would allow. Apparently that is
wrong. That is why I asked the question. I would have thought this
would be a very basic question, but it appears to be a difficult one.
I simply want to instantiate a class that resides in a different file
than the cs source file of the aspx page. I thought it would be easy
for those who were more familar with the language and .net platform.

Don't get me wrong, I am thankful for any help, but I really don't get
the problem here. I have my reasons for asking the question. Under
normal circumstances I would proceed normally. I can't in this case.

Daniel wrote:
>Why are you so against using a dll? A dll is the way to go and is not a
bad
thing. During development it will be a cs file once compiled a dll is
created but it is still, referencing inside the dll.

Use codebhind, and it works. Why you are so aginst this i do not know.
You
are creating the problem here. Sounds like your stuck in java world which
i
think is why your struggling. Unlearn what you have learnt ;) use
codebhind,
dont question what workd and use the compiled dll. At deployment you will
never use a cs file.

If you can't take the advice, there is no use trying to help you further
'cause your gonan fight it and fight it and come back to this conclusion.
If
you don't, then well, don't give up the day job.

And on another note. WHY are you using notepad? While your at it, turn
off
your computer, get out a pen and paper. You seem to want to make simple
things complicated?

Seriously, think about it.
<ne***********@gmail.comwrote in message
news:11**********************@p79g2000cwp.googleg roups.com...
>I suppose I can take the code out of my class and put it in each file
that needs it, but that is not the correct way to proceed, I am sure.
ne***********@gmail.com wrote:
I have a .aspx file and it's src. I also have a third file, a class
that the src references. Everything is in the same directory/folder.
Everything has the same namespace. How do I reference the class in my
c# .src file? I don't believe this is an ASP.NET question, but a OOP
C# question, thus my post here.

I have searched and I thought it was with:

using FilterSQL; //the name of my class
using reports.FilterSQL; //name of namespace with class.

...

then on down I can instantiate it with

FilterSQL myFilter = new FilterSQL("");

I need to say that it was working until I took Visual Studio out of
the
picture. I am trying to use notepad. And what happened was that I
took out my "codebehind" directive and used "src." Now, it can't find
the class.

Thank you for any help. I think not using VIsual Studio here might
actually be a good thing. I might learn what's going on.

Sep 16 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jim Red | last post by:
hello first of all, i know, there are no classes in javascript. but i will use that word for better understanding of my question. here we go. i have three classes and need a reference to the...
5
by: Javier Campos | last post by:
WARNING: This is an HTML post, for the sake of readability, if your client can see HTML posts, do it, it doesn't contain any script or virus :-) I can reformat a non-HTML post if you want me to (and...
4
by: z_learning_tester | last post by:
I'm reading the MS press C# book and there seems to be a contradiction. Please tell me which one is correct, 1 or 2. Thanks! Jeff 1. First it gives the code below saying that it prints 0 then...
4
by: Edward Diener | last post by:
I have a class Y in assembly B which is derived from a class Z in assembly C. So I correctly add a reference to assembly C in assembly B, build assembly B and everything builds fine. Now I create...
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
11
by: Just Me | last post by:
I have a solution containing many usercontrol projects. When I wish to reference a usercontrol in another project I can select either the project or the assembly. Does it make a difference which...
12
by: scottt | last post by:
hi, I am having a little problem passing in reference of my calling class (in my ..exe)into a DLL. Both programs are C# and what I am trying to do is pass a reference to my one class into a DLL...
9
by: MSDNAndi | last post by:
Hi, I have the following problem with VS 2005 (Professional) and C# 2.0 I will use assembly and namespace synonymously here. I have a class in namespace InheritClass inherit from a baseclass...
8
by: Bart Simpson | last post by:
If a class has a member variable that is a reference. What happens to teh class that is being referenced, when the containing class is destroyed? e.g. Class A{ }; Class B { B(const A&...
12
by: Bryan Parkoff | last post by:
I write my large project in C++ source code. My C++ source code contains approximate four thousand small functions. Most of them are inline. I define variables and functions in the global scope....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.