Mutliple Regions within a procedure


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 8 of 8

Thread: Mutliple Regions within a procedure

  1. #1
    Patrick Long Guest

    Mutliple Regions within a procedure

    I have just finished a large VB6 MTS COM framework. All our code had
    standard header, footer and errorhandler.
    It was said that the template code made it harder to see the real code. IN
    VB.NET I notice that you can hide and expand code within a proc. While I
    have been able to do this using a menu command I would like to have a
    description associated with each piece of headed text. This is similar to
    the

    Region " Windows Form Designer generated code "

    that you get in a winforms application. Can you many of these in an
    procedure?

    Pat



  2. #2
    Rob Teixeira Guest

    Re: Mutliple Regions within a procedure


    Everything you type between

    #Region "this is the region description"
    '.. code in here ..
    #End Region

    will be collapsable with the label of the description.
    You can embed regions within regions, and within procedures, but it seems
    like only the outer region is collapsable. This may be a bug with beta 1.

    -Rob

    "Patrick Long" <Patrick_long@csi.com> wrote:
    >I have just finished a large VB6 MTS COM framework. All our code had
    >standard header, footer and errorhandler.
    >It was said that the template code made it harder to see the real code.

    IN
    >VB.NET I notice that you can hide and expand code within a proc. While I
    >have been able to do this using a menu command I would like to have a
    >description associated with each piece of headed text. This is similar to
    >the
    >
    >Region " Windows Form Designer generated code "
    >
    >that you get in a winforms application. Can you many of these in an
    >procedure?
    >
    >Pat
    >
    >



  3. #3
    Phil Weber Guest

    Re: Mutliple Regions within a procedure

    > You can embed regions within regions, and within procedures,
    > but it seems like only the outer region is collapsible. This may
    > be a bug with Beta 1.


    Rob: That would seem to be the case. Nested regions collapse as expected in
    recent builds.
    ---
    Phil Weber



  4. #4
    Mark Hurd Guest

    Re: Mutliple Regions within a procedure

    "Phil Weber" <pweber@devx.com> wrote in message
    news:3aebaa6d@news.devx.com...
    > > You can embed regions within regions, and within procedures,
    > > but it seems like only the outer region is collapsible. This may
    > > be a bug with Beta 1.

    >
    > Rob: That would seem to be the case. Nested regions collapse as expected

    in
    > recent builds.


    In the Beta 1 release nested regions worked for me (think namespace and
    every other region inside it) but 'manual' regions (delimited by #Region ...
    #End Region) were collapsible only when they were OUTSIDE of 'code'. That is
    they collapsed if they contained a complete routine, but not if they were
    contained within a routine.

    In this example, the I think the regions could be used to aid readability:

    Public Class Class1

    Sub TestingRegion()

    #Region " Local Vars..."

    Dim X As Integer

    Dim Y As Double

    #End Region

    Y = 0.265464124321762

    For X = 1 To 100

    #Region " Complex stuff for Y..."

    Y = 4 * Y * (1 - Y)

    #End Region

    Next

    End Sub

    End Class

    This is what I hope to be available. NB I'd like to not have to manually add
    the indentation too!

    Please check your 'current builds' :-)

    Regards,
    Mark Hurd, B.Sc.(Ma.) (Hons.)

    > ---
    > Phil Weber
    >
    >






  5. #5
    Paul Mc Guest

    Re: Mutliple Regions within a procedure


    G'day - just thought that I would throw my 2 cents in...

    In my Beta 1 regions arecollapsible no matter where I put them - inside subs,
    or outside. However, sometimes they don't get picked up too well - however
    closing and reopening the code file gset them happening properly.

    Cheers,
    Paul

  6. #6
    Mark Hurd Guest

    Re: Mutliple Regions within a procedure

    "Paul Mc" <paulmc@nospam.thehub.com.au> wrote in message
    news:3af71e92$1@news.devx.com...
    >
    > G'day - just thought that I would throw my 2 cents in...
    >
    > In my Beta 1 regions arecollapsible no matter where I put them - inside

    subs,
    > or outside. However, sometimes they don't get picked up too well - however
    > closing and reopening the code file gset them happening properly.
    >
    > Cheers,
    > Paul


    That's funny, and I can't tell you why :-)

    Anyway, it looks like I should try to find some time to free up 0.5GB to
    reinstall VS.Net Beta 1. I've got a couple of pieces of evidence of reduced
    functionality compared to other people. Unfortunately this PC has become
    more of a production system than it was when I first decided it was safe to
    install the Beta :-(

    Regards,
    Mark Hurd, B.Sc.(Ma.) (Hons.)



  7. #7
    Paul Mc Guest

    Re: Mutliple Regions within a procedure


    G'day again Mark.

    >Are you referring to C#?


    Nope - VB. Just last night I wrote a fairly long proc, took a look at it,
    and folded it up nicely into three regions - all within
    Sub..End sub

    I have experienced some inconsistency as to the IDE recognising regions to
    collapse, but as I said, closing and reopening has always fixed that up for
    me...

    Cheers,
    Paul

  8. #8
    Mark Hurd Guest

    Re: Mutliple Regions within a procedure

    "Paul Mc" <paulmc@nospam.thehub.com.au> wrote in message
    news:3af71e92$1@news.devx.com...
    >
    > G'day - just thought that I would throw my 2 cents in...
    >
    > In my Beta 1 regions arecollapsible no matter where I put them - inside

    subs,
    > or outside. However, sometimes they don't get picked up too well - however
    > closing and reopening the code file gset them happening properly.
    >
    > Cheers,
    > Paul


    OK, I've played a bit further: Are you referring to C#? It can collapse
    regions inside routines in Beta 1 (and doesn't need the quotes).

    Regards,
    Mark Hurd, B.Sc.(Ma.) (Hons.)



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center