#include equilvelant

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Fellows

    #include equilvelant

    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


  • Jorge

    #2
    #include equilvelant

    Hello Mike

    I'am not sure but Imports namespace.eleme nt might work.

    Kind Regards
    Jorge Cavalheiro

    [color=blue]
    >-----Original Message-----
    >ok my code that im doing in .net is now starting to look[/color]
    fairly complicated,[color=blue]
    >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[/color]
    better word[color=blue]
    >
    >all i want to do is have one file which has all of my[/color]
    major definations in[color=blue]
    >it
    >
    >whereas in c++ i would do #include what do i do in[/color]
    vb.net?[color=blue]
    >
    >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[/color]
    classes i make[color=blue]
    >
    >ive tried and tried to do this in vb and just cant
    >
    >
    >Regards
    >
    >
    >Mike Fellows
    >
    >
    >.
    >[/color]

    Comment

    • Trev Hunter

      #3
      Re: #include equilvelant

      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" <mike.fellows.S PAM@equityhouse .co.uk> wrote in message
      news:vq2Wb.89$H J1.26@newsfep3-gui.server.ntli .net...[color=blue]
      > ok my code that im doing in .net is now starting to look fairly[/color]
      complicated,[color=blue]
      > 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
      >
      >[/color]


      Comment

      • Armin Zingler

        #4
        Re: #include equilvelant

        "Mike Fellows" <mike.fellows.S PAM@equityhouse .co.uk> schrieb[color=blue]
        > 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[/color]

        Write class libraries to get reusable code.


        --
        Armin

        How to quote and why:



        Comment

        • Mike Fellows

          #5
          Re: #include equilvelant

          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.nospam@free net.de> wrote in message
          news:eiLMpU97DH A.3704@tk2msftn gp13.phx.gbl...[color=blue]
          > "Mike Fellows" <mike.fellows.S PAM@equityhouse .co.uk> schrieb[color=green]
          > > 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[/color]
          >
          > 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
          >[/color]


          Comment

          • CJ Taylor

            #6
            Re: #include equilvelant


            "Mike Fellows" <mike.fellows.S PAM@equityhouse .co.uk> wrote in message
            news:JH6Wb.231$ HJ1.90@newsfep3-gui.server.ntli .net...[color=blue]
            > 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[/color]

            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
            [color=blue]
            >
            > Thanks
            >
            > Mike Fellows
            >
            >
            > "Armin Zingler" <az.nospam@free net.de> wrote in message
            > news:eiLMpU97DH A.3704@tk2msftn gp13.phx.gbl...[color=green]
            > > "Mike Fellows" <mike.fellows.S PAM@equityhouse .co.uk> schrieb[color=darkred]
            > > > 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[/color]
            > >
            > > 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
            > >[/color]
            >
            >[/color]


            Comment

            • Rick Mogstad

              #7
              Re: #include equilvelant


              "Mike Fellows" <mike.fellows.S PAM@equityhouse .co.uk> wrote in message
              news:JH6Wb.231$ HJ1.90@newsfep3-gui.server.ntli .net...[color=blue]
              > 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
              >[/color]

              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.


              Comment

              • Cor

                #8
                Re: #include equilvelant

                Hi CJ,

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

                Cor
                [color=blue]
                > 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. =)
                >[/color]


                Comment

                • CJ Taylor

                  #9
                  Re: #include equilvelant

                  ....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" <non@non.com> wrote in message
                  news:OmPkKMA8DH A.2812@TK2MSFTN GP11.phx.gbl...[color=blue]
                  > Hi CJ,
                  >
                  > Very strong and very very good, there is so much in that sentence from you
                  > without that it is written..
                  >
                  > Cor
                  >[color=green]
                  > > Not really. Each language has its own set of features. VB is a[/color][/color]
                  Microsoft[color=blue][color=green]
                  > > product (well now it is.. Used to be Thunderbird or something like that[/color][/color]
                  in[color=blue][color=green]
                  > > the 1.0 incarnation) and C was a Bell Labs product. Developed for 2
                  > > entirely different reasons and shared nothing incommon until recently.[/color][/color]
                  =)[color=blue][color=green]
                  > >[/color]
                  >
                  >[/color]


                  Comment

                  • Cor

                    #10
                    Re: #include equilvelant

                    Hi CJ,
                    [color=blue]
                    > ...Detecting flame....[/color]
                    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.
                    [color=blue]
                    >
                    > I think this is good. =)[/color]
                    Yes, but I cannot explain because than your messages looses its power.

                    :-)

                    Cor


                    Comment

                    • CJ Taylor

                      #11
                      Re: #include equilvelant


                      "Cor" <non@non.com> wrote in message
                      news:OMNyuXA8DH A.3008@TK2MSFTN GP09.phx.gbl...[color=blue]
                      > Hi CJ,
                      >[color=green]
                      > > ...Detecting flame....[/color]
                      > Did I do that ever to you?
                      > You see me seldom do that only to Herfried sometimes and he knows than[/color]
                      that[color=blue]
                      > it is just for fun.[/color]

                      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. =)
                      [color=blue]
                      >[color=green]
                      > >
                      > > I think this is good. =)[/color]
                      > Yes, but I cannot explain because than your messages looses its power.
                      >
                      > :-)[/color]

                      Understood and thank you. =)
                      [color=blue]
                      >
                      > Cor
                      >
                      >[/color]


                      Comment

                      • Abubakar

                        #12
                        Re: #include equilvelant

                        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" <mike.fellows.S PAM@equityhouse .co.uk> wrote in message
                        news:vq2Wb.89$H J1.26@newsfep3-gui.server.ntli .net...[color=blue]
                        > ok my code that im doing in .net is now starting to look fairly[/color]
                        complicated,[color=blue]
                        > 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
                        >
                        >[/color]


                        Comment

                        • Tom Shelton

                          #13
                          Re: #include equilvelant

                          On 2004-02-10, Trev Hunter <hunter_trev@ho tmail.com> wrote:[color=blue]
                          > 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.
                          >[/color]

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

                          Comment

                          • Tom Shelton

                            #14
                            Re: #include equilvelant

                            On 2004-02-10, Mike Fellows <mike.fellows.S PAM@equityhouse .co.uk> wrote:[color=blue]
                            > 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[/color]

                            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.

                            Comment

                            • Trev Hunter

                              #15
                              Re: #include equilvelant

                              [color=blue]
                              > 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).[/color]

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

                              Trev.


                              Comment

                              Working...