By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,887 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,887 IT Pros & Developers. It's quick & easy.

#include equilvelant

P: n/a
ok my code that im doing in .net is now starting to look fairly complicated,
what started out as a small project has grown and grown
and its time for some house keeping of my code

im trying to implement a .h (c++) file for use of a better word

all i want to do is have one file which has all of my major definations in
it

whereas in c++ i would do #include what do i do in vb.net?

i.e. i want
dim x as string = "abcdefg"
dim y as stirng = "hijklmno"

but i want to be able to include x and y in any other classes i make

ive tried and tried to do this in vb and just cant
Regards
Mike Fellows
Nov 20 '05 #1
Share this Question
Share on Google+
23 Replies


P: n/a
Hello Mike

I'am not sure but Imports namespace.element might work.

Kind Regards
Jorge Cavalheiro

-----Original Message-----
ok my code that im doing in .net is now starting to look fairly complicated,what started out as a small project has grown and grown
and its time for some house keeping of my code

im trying to implement a .h (c++) file for use of a better word
all i want to do is have one file which has all of my major definations init

whereas in c++ i would do #include what do i do in vb.net?
i.e. i want
dim x as string = "abcdefg"
dim y as stirng = "hijklmno"

but i want to be able to include x and y in any other classes i make
ive tried and tried to do this in vb and just cant
Regards
Mike Fellows
.

Nov 20 '05 #2

P: n/a
Mike,

Are you referring to inline including of files? If so, VB.net doesn't
support this.

Alternatives include the following:

1) Define Commonly used constants and methods in a module and then add the
module to your project. You won't be able to define code snippets in this
way - just commonly used methods, constants and variables. A copy of the
file will be created when you add it to your project.

2) Drag a code snippet to the toolbox in visual studio and rename it. When
you want to insert it, simply drag and drop.

3) As with (1), except design it so it can be put into a class library of
its own and then reference the class library.
HTH,

Trev.



"Mike Fellows" <mi***************@equityhouse.co.uk> wrote in message
news:vq*************@newsfep3-gui.server.ntli.net...
ok my code that im doing in .net is now starting to look fairly complicated, what started out as a small project has grown and grown
and its time for some house keeping of my code

im trying to implement a .h (c++) file for use of a better word

all i want to do is have one file which has all of my major definations in
it

whereas in c++ i would do #include what do i do in vb.net?

i.e. i want
dim x as string = "abcdefg"
dim y as stirng = "hijklmno"

but i want to be able to include x and y in any other classes i make

ive tried and tried to do this in vb and just cant
Regards
Mike Fellows

Nov 20 '05 #3

P: n/a
"Mike Fellows" <mi***************@equityhouse.co.uk> schrieb
ok my code that im doing in .net is now starting to look fairly
complicated, what started out as a small project has grown and
grown and its time for some house keeping of my code

im trying to implement a .h (c++) file for use of a better word

all i want to do is have one file which has all of my major
definations in it

whereas in c++ i would do #include what do i do in vb.net?

i.e. i want
dim x as string = "abcdefg"
dim y as stirng = "hijklmno"

but i want to be able to include x and y in any other classes i
make

ive tried and tried to do this in vb and just cant


Write class libraries to get reusable code.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4

P: n/a
Thanks Guys

it seems strange that this is missing from VB
but since I only need to create a load of reuasble variables,
the creating of a module will do for now

Thanks

Mike Fellows
"Armin Zingler" <az*******@freenet.de> wrote in message
news:ei**************@tk2msftngp13.phx.gbl...
"Mike Fellows" <mi***************@equityhouse.co.uk> schrieb
ok my code that im doing in .net is now starting to look fairly
complicated, what started out as a small project has grown and
grown and its time for some house keeping of my code

im trying to implement a .h (c++) file for use of a better word

all i want to do is have one file which has all of my major
definations in it

whereas in c++ i would do #include what do i do in vb.net?

i.e. i want
dim x as string = "abcdefg"
dim y as stirng = "hijklmno"

but i want to be able to include x and y in any other classes i
make

ive tried and tried to do this in vb and just cant


Write class libraries to get reusable code.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5

P: n/a

"Mike Fellows" <mi***************@equityhouse.co.uk> wrote in message
news:JH**************@newsfep3-gui.server.ntli.net...
Thanks Guys

it seems strange that this is missing from VB
but since I only need to create a load of reuasble variables,
the creating of a module will do for now
Not really. Each language has its own set of features. VB is a Microsoft
product (well now it is.. Used to be Thunderbird or something like that in
the 1.0 incarnation) and C was a Bell Labs product. Developed for 2
entirely different reasons and shared nothing incommon until recently. =)

So not really strange at all. =)

-CJ

Thanks

Mike Fellows
"Armin Zingler" <az*******@freenet.de> wrote in message
news:ei**************@tk2msftngp13.phx.gbl...
"Mike Fellows" <mi***************@equityhouse.co.uk> schrieb
ok my code that im doing in .net is now starting to look fairly
complicated, what started out as a small project has grown and
grown and its time for some house keeping of my code

im trying to implement a .h (c++) file for use of a better word

all i want to do is have one file which has all of my major
definations in it

whereas in c++ i would do #include what do i do in vb.net?

i.e. i want
dim x as string = "abcdefg"
dim y as stirng = "hijklmno"

but i want to be able to include x and y in any other classes i
make

ive tried and tried to do this in vb and just cant


Write class libraries to get reusable code.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


Nov 20 '05 #6

P: n/a

"Mike Fellows" <mi***************@equityhouse.co.uk> wrote in message
news:JH**************@newsfep3-gui.server.ntli.net...
Thanks Guys

it seems strange that this is missing from VB
but since I only need to create a load of reuasble variables,
the creating of a module will do for now

Thanks

Mike Fellows


Missing what? Its really unnecessary in VB. You dont need to use #include because you can just
include the "header file" in the project and use its public variables, functions, etc.
Nov 20 '05 #7

P: n/a
Cor
Hi CJ,

Very strong and very very good, there is so much in that sentence from you
without that it is written..

Cor
Not really. Each language has its own set of features. VB is a Microsoft
product (well now it is.. Used to be Thunderbird or something like that in
the 1.0 incarnation) and C was a Bell Labs product. Developed for 2
entirely different reasons and shared nothing incommon until recently. =)

Nov 20 '05 #8

P: n/a
....Detecting flame....

.... inconclusive....

I think this is good. =) But not really sure sometimes. =)

without that it is written..
is throwing me off... could you explain a little?

Thanks,
CJ

"Cor" <no*@non.com> wrote in message
news:Om**************@TK2MSFTNGP11.phx.gbl...
Hi CJ,

Very strong and very very good, there is so much in that sentence from you
without that it is written..

Cor
Not really. Each language has its own set of features. VB is a Microsoft product (well now it is.. Used to be Thunderbird or something like that in the 1.0 incarnation) and C was a Bell Labs product. Developed for 2
entirely different reasons and shared nothing incommon until recently. =)


Nov 20 '05 #9

P: n/a
Cor
Hi CJ,
...Detecting flame.... Did I do that ever to you?
You see me seldom do that only to Herfried sometimes and he knows than that
it is just for fun.

I think this is good. =)

Yes, but I cannot explain because than your messages looses its power.

:-)

Cor
Nov 20 '05 #10

P: n/a

"Cor" <no*@non.com> wrote in message
news:OM**************@TK2MSFTNGP09.phx.gbl...
Hi CJ,
...Detecting flame.... Did I do that ever to you?
You see me seldom do that only to Herfried sometimes and he knows than

that it is just for fun.
Rough week. =) Recently I've been charged with developing an ODBC driver
for a propertary database...

Hmmm.... CJ doesn't know how to write an ODBC driver, but I do have a
library by the OEM that gives me all my table calls etc... So I'm a little
paranoid about everything right now.

And no, you have never flamed me, maybe just commented when I was a little
out of line. And obviously nothing wrong with that. =)

I think this is good. =) Yes, but I cannot explain because than your messages looses its power.

:-)


Understood and thank you. =)

Cor

Nov 20 '05 #11

P: n/a
hey instead of using the module u could put those variables in some base
class, make them protected and inherits tha class in any other class where
you want those variables. This is the way you can use variables by
declaraing them once. Ok as far as the header file thing goes, mainly the
header file in c++ is used to contain function prototypes. What you can do
to simulate this in vb.net is first design the interface of your class and
write an interface class. Than implement that interface any where you like.
"Mike Fellows" <mi***************@equityhouse.co.uk> wrote in message
news:vq*************@newsfep3-gui.server.ntli.net...
ok my code that im doing in .net is now starting to look fairly complicated, what started out as a small project has grown and grown
and its time for some house keeping of my code

im trying to implement a .h (c++) file for use of a better word

all i want to do is have one file which has all of my major definations in
it

whereas in c++ i would do #include what do i do in vb.net?

i.e. i want
dim x as string = "abcdefg"
dim y as stirng = "hijklmno"

but i want to be able to include x and y in any other classes i make

ive tried and tried to do this in vb and just cant
Regards
Mike Fellows

Nov 20 '05 #12

P: n/a
On 2004-02-10, Trev Hunter <hu*********@hotmail.com> wrote:
Mike,

Are you referring to inline including of files? If so, VB.net doesn't
support this.

Alternatives include the following:

1) Define Commonly used constants and methods in a module and then add the
module to your project. You won't be able to define code snippets in this
way - just commonly used methods, constants and variables. A copy of the
file will be created when you add it to your project.


Not necessarily, you can chose to link to the file, so that all projects
that use it share the same copy (hit the little arrow on the Open button
for this choice).

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
A priest advised Voltaire on his death bed to renounce the devil.
Replied Voltaire, "This is no time to make new enemies."
Nov 20 '05 #13

P: n/a
On 2004-02-10, Mike Fellows <mi***************@equityhouse.co.uk> wrote:
ok my code that im doing in .net is now starting to look fairly complicated,
what started out as a small project has grown and grown
and its time for some house keeping of my code

im trying to implement a .h (c++) file for use of a better word

all i want to do is have one file which has all of my major definations in
it

whereas in c++ i would do #include what do i do in vb.net?

i.e. i want
dim x as string = "abcdefg"
dim y as stirng = "hijklmno"

but i want to be able to include x and y in any other classes i make

ive tried and tried to do this in vb and just cant
Regards
Mike Fellows


As others have said, this isn't possible from VB.NET - at least in the
same way. Putting these in a module that is shared or in a class
library is probably the easiest way to go... But, there is another
alternative. The VB.NET compiler does understand the concept of
modules. Modules are small chunks of compiled code that can be inserted
into assemblies - together these can make up multifile assemblies. Just
because an assembly is usually just a single file, doesn't mean it has
to be :) The difficulty is that the IDE doesn't understand
them, so to use them you have to compile from the command line.

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
Once you've tried to change the world you find it's a whole bunch easier
to change your mind.
Nov 20 '05 #14

P: n/a
Not necessarily, you can chose to link to the file,
so that all projects that use it share the same
copy (hit the little arrow on the Open button
for this choice).


You learn something new every day ;) Cheers for the tip.

Trev.
Nov 20 '05 #15

P: n/a
* "Cor" <no*@non.com> scripsit:
Very strong and very very good, there is so much in that sentence from you
without that it is written..


ACK.
Not really. Each language has its own set of features. VB is a Microsoft
product (well now it is.. Used to be Thunderbird or something like that in
the 1.0 incarnation) and C was a Bell Labs product. Developed for 2


VB's codename was "Thunder".

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #16

P: n/a

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ej**************@TK2MSFTNGP12.phx.gbl...
* "Cor" <no*@non.com> scripsit:
Very strong and very very good, there is so much in that sentence from you
without that it is written..
ACK.


Again... not sure what that means. =)
Not really. Each language has its own set of features. VB is a Microsoft product (well now it is.. Used to be Thunderbird or something like that in the 1.0 incarnation) and C was a Bell Labs product. Developed for 2


VB's codename was "Thunder".


I was close. =) I think Thunderbird is better though. =)
;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #17

P: n/a
* "CJ Taylor" <no****@blowgoats.com> scripsit:
I was close. =) I think Thunderbird is better though. =)


I remember Thunderbird is a really slow newsreader...

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #18

P: n/a
Cor
Hi Herfried,
I remember Thunderbird is a really slow newsreader...


Reminds me that CJ said that he had a problem with Guru, is that something
the same as Gnu.

:-))

Cor
Nov 20 '05 #19

P: n/a
* "Cor" <no*@non.com> scripsit:
I remember Thunderbird is a really slow newsreader...


Reminds me that CJ said that he had a problem with Guru, is that something
the same as Gnu.


Guru is a newsreader? I never heard this name...

My newsreader's name is "Gnus" (it runs in XEmacs).

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #20

P: n/a
On 2004-02-11, Herfried K. Wagner [MVP] <hi***************@gmx.at> wrote:
* "Cor" <no*@non.com> scripsit:
I remember Thunderbird is a really slow newsreader...


Reminds me that CJ said that he had a problem with Guru, is that something
the same as Gnu.


Guru is a newsreader? I never heard this name...

My newsreader's name is "Gnus" (it runs in XEmacs).


Emacs - twister for your fingers...

Emacs is a nice OS, but I prefere something a little leaner. I'm a vi
man myself :)

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
Nothing in life is to be feared. It is only to be understood.
Nov 20 '05 #21

P: n/a
Tom,

* Tom Shelton <to*@mtogden.com> scripsit:
Guru is a newsreader? I never heard this name...

My newsreader's name is "Gnus" (it runs in XEmacs).
Emacs - twister for your fingers...


Yep.
Emacs is a nice OS, but I prefere something a little leaner. I'm a vi
man myself :)


I'll have a look at the newsreader you are using soon.

;-)

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #22

P: n/a
wtf? Where did this post from Cor come from?
"Tom Shelton" <to*@mtogden.com> wrote in message
news:uh**************@TK2MSFTNGP10.phx.gbl...
On 2004-02-11, Herfried K. Wagner [MVP] <hi***************@gmx.at> wrote:
* "Cor" <no*@non.com> scripsit:
I remember Thunderbird is a really slow newsreader...

Reminds me that CJ said that he had a problem with Guru, is that something the same as Gnu.


Guru is a newsreader? I never heard this name...

My newsreader's name is "Gnus" (it runs in XEmacs).


Emacs - twister for your fingers...

Emacs is a nice OS, but I prefere something a little leaner. I'm a vi
man myself :)

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
Nothing in life is to be feared. It is only to be understood.

Nov 20 '05 #23

P: n/a
Cor
Hi CJ,

When I can prickle Herfried with anything that looks as his hamser (gnus)
then I do it, I saw your guru language that was used on the database and was
waiting waiting and here it was.

Sometimes I have stupid answers or question who are not by accident.

(I wrote gnu because it looks a little bit more on guru by instance)

http://hamster.volker-gringmuth.de/

It needs no investigation Fergus did it already, you know I think already
what he said about this newsreader from Herfried.

:-))

Cor
Nov 20 '05 #24

This discussion thread is closed

Replies have been disabled for this discussion.