To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic .NET

Reply Post New Thread
 
Thread Tools Display Modes
Old Feb 23rd, 2005, 06:45 PM   #1
Ruku
Fanatic Member
 
Ruku's Avatar
 
Join Date: Jul 02
Location: Canada
Posts: 655
Ruku is an unknown quantity at this point (<10)
Thinking foward... Execute code once in loop?

I found the Static declaration very useful since you can declare a variable once and let it run threw a loop or sub

ex:

VB Code:
  1. Form_MouseClick
  2.    Static Click as Integer = 1
  3. End Sub

which is pretty usefull

anyways, I was wondering if something could do like:

VB Code:
  1. Do
  2. a += 1
  3. b += 2 + a
  4. (Some kind of structure header here)
  5. c=b
  6. (Footer structure here)
  7. Loop

Anyways, to get the result of the c variable only once, meh, I was just curious if some new structure could have 'been created...

Well, .net, let's think foward!

(btw don't answer me like use flags and do if statements... There are probably billions of ways to do this, I was just wondering if some new stuff was boiling to be used )

__________________

Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
Website: http://DreamForgery.com
Ruku is offline   Reply With Quote
Old Feb 24th, 2005, 03:21 AM   #2
wossname
Dream Theater Fan
 
wossname's Avatar
 
Join Date: Aug 02
Location: #!/bin/bash
Posts: 5,639
wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)
Re: Thinking foward... Execute code once in loop?

You post makes no sense at all.
__________________
RPNSolve version 1.1.3 (Free commandline math parser) Go on, it's for charity.
Registered Linux user number 0x7468A.
My Flickr


Of course you're free to go // Go and tell the world my story // Tell them about my brother // Tell them about me // The Count of Tuscany
wossname is offline   Reply With Quote
Old Feb 24th, 2005, 03:22 AM   #3
mar_zim
Frenzied Member
 
mar_zim's Avatar
 
Join Date: Feb 04
Location: Toledo Cebu City.
Posts: 1,416
mar_zim has a spectacular aura about (100+)mar_zim has a spectacular aura about (100+)
Re: Thinking foward... Execute code once in loop?

Quote:
Originally Posted by wossname
You post makes no sense at all.
that's rude.
mar_zim is offline   Reply With Quote
Old Feb 24th, 2005, 03:37 AM   #4
wossname
Dream Theater Fan
 
wossname's Avatar
 
Join Date: Aug 02
Location: #!/bin/bash
Posts: 5,639
wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)wossname is a glorious beacon of light (400+)
Re: Thinking foward... Execute code once in loop?

Quote:
Originally Posted by mar_zim
that's rude.
Just a concise observation. No rudeness intended.

I humbly apologise for any anguish, distress or trauma that my earlier comments may have illicited in those of a delicate sensibility.

__________________
RPNSolve version 1.1.3 (Free commandline math parser) Go on, it's for charity.
Registered Linux user number 0x7468A.
My Flickr


Of course you're free to go // Go and tell the world my story // Tell them about my brother // Tell them about me // The Count of Tuscany
wossname is offline   Reply With Quote
Old Feb 24th, 2005, 04:34 AM   #5
Ideas Man
Frenzied Member
 
Ideas Man's Avatar
 
Join Date: Aug 02
Location: Australia
Posts: 1,718
Ideas Man has a spectacular aura about (125+)Ideas Man has a spectacular aura about (125+)
Re: Thinking foward... Execute code once in loop?

Can you explain this a little better what you're asking/doing? I also didn't quite understand it.
__________________
I use Microsoft Visual Basic 2005. (Therefore, most code samples I provide will be based around the .NET Framework v2.0, unless otherwise specified)
Ideas Man is offline   Reply With Quote
Old Feb 28th, 2005, 02:05 PM   #6
Ruku
Fanatic Member
 
Ruku's Avatar
 
Join Date: Jul 02
Location: Canada
Posts: 655
Ruku is an unknown quantity at this point (<10)
Red face Re: Thinking foward... Execute code once in loop?

uh, ok, sorry for not being crystal clear...

After using the variable declaration method with Static, that can declare a variable used through let's say a form, the variable is only declared once and it becomes available through the whole form. (lookup "Static" for more info)

Anyways,

I was wondering,

Is there a new way to execute a bunch of code, only once even if it's in a loop?

my previous code:
VB Code:
  1. Do
  2. a += 1
  3. b += 2 + a
  4. (The Function)
  5.    c = b
  6. (Footer of function)
  7. Loop Until a = 50

Meaning the c variable will be grabbed ONCE in the loop, regardless of the values changing in the 2nd, 3rd, etc loop.

I think hope it's all clear now...

I know I could use a flag method with an IF to do that, but I'm just exploring new functions...
__________________

Using VB.NET 2005/.NET 2.0, NetBeans IDE 5, Fujitsu Cobol85,
Website: http://DreamForgery.com
Ruku is offline   Reply With Quote
Old Feb 28th, 2005, 03:21 PM   #7
<ABX
Frenzied Member
 
<ABX's Avatar
 
Join Date: Jul 02
Location: Canada eh...
Posts: 1,621
<ABX has a spectacular aura about (125+)<ABX has a spectacular aura about (125+)
Re: Thinking foward... Execute code once in loop?

Then Nope, it would have to be before or after the loop to only execute once.
__________________
Tips:
  • Google is your friend! Search before posting!
  • Name your thread appropriately... "I Need Help" doesn't cut it!
  • Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
  • Allways Include the Name and Line of the Exception (if one is occuring!)
  • If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)

If you think I was helpful, rate my post
IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
<ABX is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic .NET


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:24 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.