|
-
Jul 7th, 2004, 03:17 AM
#1
Thread Starter
Frenzied Member
#region
I'm trying to migrate some C# code over to VB and have hit a snag...
the C# code has this in it...
#region
#endregion
but VB tells me that i can't have this in method bodies...
what can I do here? do I need these?
Thanks,
squirrelly1
Now happily married and still crankin' away at the keyboard.  Life is grand for a coder, no?
-
Jul 7th, 2004, 04:11 AM
#2
Fanatic Member
if i'm not wrong it is just used for regioning blocks. but prohibited in vb for some reason [which i don't know]. you can do regioning in C# even in control flow blocks. i guess, just delete it.
the thing is that you can't expand-collapse the [should-be region] code in your C#...
-
Jul 7th, 2004, 04:12 AM
#3
New Member
Believe that VB says to you
Organising your code into regions is not obligatory for compiler, but just good practice to make your coding easily readable.
-
Jul 7th, 2004, 04:33 AM
#4
Why would you have a region block within a method?
If it's so long that it requires a region then your mehod needs to be rewritten.
-
Jul 7th, 2004, 05:23 AM
#5
Hyperactive Member
#Region and #End Region are allowed in VB, I use them all the time for large projects where a class module might contain several thousand lines of code. I think your problem lies in the "#endregion" key word, just put a space between #end and region and that should fix your problem.
Whadayamean it doesn't work....
It works fine on my machine!

-
Jul 7th, 2004, 12:30 PM
#6
Member
I was using outlining (select x lines, right click, outlining, hide selection) works great aswell, but when I start the next day all my outlining is gone and 'standard' outlining is back again....
Is there a way to fix this or is outlining supposed to be short lived and you've got to use #region & #end region for regions that survive a save & reload?
-
Jul 7th, 2004, 12:55 PM
#7
Originally posted by cphoenixc
I was using outlining (select x lines, right click, outlining, hide selection) works great aswell, but when I start the next day all my outlining is gone and 'standard' outlining is back again....
Is there a way to fix this or is outlining supposed to be short lived and you've got to use #region & #end region for regions that survive a save & reload?
Yeah, I think that type of code hiding only works for the current running of the IDE. I don't think it actualy adds #region tags to it, so they are not saved.
TG
-
Jul 10th, 2004, 11:04 AM
#8
Lively Member
Yeah, I think that type of code hiding only works for the current running of the IDE. I don't think it actualy adds #region tags to it, so they are not saved.
The problem maybe really this type...
but did you try putting a caption for the #Region...#End Region block?
This is done by inserting constant string value after the #Region keyword, like this:
VB Code:
#Region "Here put the caption text"
. . .
#End Region
About dividing your method into blocks, #Region statement can't appear in method level, only directly in the class\Module or outside the Class/Module if you want to group the whole Class/Module or several Classes/Modules.
I hope this reply helps...
Last edited by TLord; Jul 10th, 2004 at 12:15 PM.
Do you think my life is easy?
Do you think it's good to win?
do you think it's nice to kill?
Do you think learning is a must?
Do you think computers are nothing?
Do you think this post is stupid?
Do ypu think we're really humen?
DO YOU THINK IT'S GOOD TO THINK AT ALL? ? ? ! ! !
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|