Variables to use in more than one sub

D

dancer

Using ASP.net 1.1 and VB.Net

What is the SIMPLEST way to have 2 subroutines use the same variables (59 of
them)? I don't know much about OOP. I need a way that uses very few
concepts until I get a grasp of the process.
 
S

Sam

If the 2 subroutines in the same class, you can use a class scope variable
with in that class. If they are in separate classes, you can declare a
variable in a module which is visible to all classes

Sam
 
T

Tim Mackey

hi
since you are in asp.net, i am guessing that the code you are writing will
be in a page. Every page in asp.net is a class. if you put your variables
inside the class declaration, all the subroutines can share the variables.
if you are in visual studio, the 'class' is defined in the code-behind file.
the asp.net quickstart tutorials are a great way to learn about asp.net.
http://samples.gotdotnet.com/quickstart/aspplus/
you will need to learn about OOP to get good at .net so it will be well
worth your time. here is another link to a VB.Net OOP introduction:
http://www.codeproject.com/vb/net/OOPS_In_VBNET.asp
plenty more on http://www.google.com/search?q=vb.net OOP

hope this helps
tim
 
J

Just Me

Using modules to declare public variables is of course possible, but to me
it begs the question, has one come up with a good design. I think having 59
public variables would suggest that improvements could be made to the OOP.

Good OOP class design ususally tried to make the class self contained in
terms of functionality. To have 59 of those in one class, although possible
*suggests* at least a '*Potential*' for loss of control and/or integrety.

I would be wary of this.

Now if your talking about system settings for contant values like
CompanyName, Phone, AdministratorsName, etc etc etc. then there are better
ways to do this than using a module.

I think the OP needs to explain why he needs these in order to get a better
insight from the experts in this group


HTH
 
S

Sam

Just Me,

I agree with what you are saying. However, since I don't know much of the
details of his application, time frame that he has to implement the changes
for the business, his language skills. I'm giving couple of quick fix
options that he can do.

Sam
 
D

dancer

Thanks for replying.
I looked here www.developerfusion.co.uk/vbnet/288/ - from the google page
you suggested.
I was trying the tutorial. It was making a lot of sense. But then I hit a
snag. The same snag that somebody else hit.
This is a question posed by another student, but it was not answered:

"I am very impressed by your tutorial as it finally allowed me to grasp the
syntax behind OOP programming with .net.
Only what I did not understand is how and where do I complile the .cs to a
dll? I cannot do it on the server. Do I do it on my local computer and then
upload? "

Would you know the answer to this question? I tried doing it from my
command prompt. I tried doing it from my localhost. No luck. I tried
putting the .cs code directly in my aspx file. Still no luck. What am I
missing?
 
D

dancer

I do have the vbc.exe on my computer in both
c:\WINNT\Microsoft.NET\Framework\v1.1.4322 and also in
v2.0.50727
 
T

Tim Mackey

hi,
if you have the .Net SDK installed on your computer, then you can look up
the documentation on how to use the compiler. i'm sure you can also run
"vbc /?" to get a list of options. if i were you i would download Visual
Web Developer (free version of Visual Studio) and then you don't need to
worry about command line syntax etc.
msdn.microsoft.com/vstudio/express/vwd/

good luck
tim
 
D

dancer

I have Visual Web Developer Express Edition, but it is overwhelming - trying
to learn the program AND the oop concept.
I am following a tutorial that is making OOP make sense to me, so I want to
continue for a while.
I figured out how to use vbc. But now I need to know how to tell what is
in a dll file. I compiled a .vb file that created a .dll. But my aspx file
that is supposed to use it ignores the info in it, if there is any. Is
there any way to see what is in that dll file?

Thanks!
 
J

Just Me

Just some general thoughts.

If you are coming from (and it sounds like you are) a place with very little
(relevent) experience in programming. Then you will find it overwhelming.
The thing to keep in mind is small victories. Because there is a wealth of
reading to be done, it in itself can get you down a bit, so concentrate on
the simpler projects to begin with and gain confidence as you go along. Be
prepared to devote your life to this; you must eat, sleep, breath and c***
this stuff, because that is what it is going to take to get anywhere useful,
and be persistent; 'always'.



You have a very long, hard road ahead of you, but like eating an Elephant,
it can be done, just not in one go!



Make good use of other minds like you are doing here, but also try and
contribute to the group as well as taking from it, because even in the
contribution you will get something out of it.



When you don't understand something fully, try and write about it with a
novice reader in mind; nothing crystallises the mind more than writing what
you don't know a great deal about.


HTH
 
D

dancer

Thank you. I am doing exactly what you recommend, except contributing to
the group, because I don't think I have anything to contribute yet.
But as for my question...... Can you tell me how to find out what is in a
dll file?
 
M

Mick Walker

dancer said:
Thank you. I am doing exactly what you recommend, except contributing to
the group, because I don't think I have anything to contribute yet.
But as for my question...... Can you tell me how to find out what is in a
dll file?
I hate suggesting this to you. But I think you are boxing above your
weight at the moment.
However if you are determined then check out Reflector
http://www.aisto.com/roeder/dotnet/ (And yes it is another IDE to learn)
 
J

Just Me

Without reading all the way up, if this is a .net dll then you can use
ILDASM to inspect whats inside the assembly. But this is probably more than
you need to know, most people never go there ;-D
 
M

Mark Rae [MVP]

Without reading all the way up, if this is a .net dll then you can use
ILDASM to inspect whats inside the assembly. But this is probably more
than you need to know, most people never go there ;-D

Indeed so - I took it from the OP that he just needed to see the
interface...
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top