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

Looping Question

P: 28
Hello all!

I would like some help with the code below. I would like to write the following using a for loop. Can anyone help?

frmResult.flgPrint.set_ColWidth(0, 2800)
frmResult.flgPrint.set_ColWidth(2, 2800)
frmResult.flgPrint.set_ColWidth(4, 2800)
frmResult.flgPrint.set_ColWidth(6, 2800)
frmResult.flgPrint.set_ColWidth(8, 2800)

Thanks
Mar 31 '07 #1
Share this Question
Share on Google+
5 Replies


Denburt
Expert 100+
P: 1,356
You didn't provide a lot of information here, but I will try to assist:


Expand|Select|Wrap|Line Numbers
  1. Do until Cnt = 2000
  2. frmResult.flgPrint.set_ColWidth(Cnt, 2800)
  3. Cnt = Cnt+2
  4. loop
Mar 31 '07 #2

Expert 5K+
P: 8,434
Since you wanted a FOR loop, try this...
Expand|Select|Wrap|Line Numbers
  1. Dim I As Long
  2. For I = 0 To 8 Step 2
  3.   frmResult.flgPrint.set_ColWidth(I, 2800)
  4. Next
Apr 1 '07 #3

Denburt
Expert 100+
P: 1,356
Thank you Killer, I guess I need to be a bit more thorough when reading. :)
Apr 1 '07 #4

vijaydiwakar
100+
P: 579
Since you wanted a FOR loop, try this...
Expand|Select|Wrap|Line Numbers
  1. Dim I As Long
  2. For I = 0 To 8 Step 2
  3.   frmResult.flgPrint.set_ColWidth(I, 2800)
  4. Next
for such a small loop use byte insted of long
or u may try inline defination also
(just for memory cunsumption purpose)
take it easy
Apr 2 '07 #5

Expert 5K+
P: 8,434
for such a small loop use byte insted of long
or u may try inline defination also
(just for memory consumption purpose)
take it easy
True, a Long uses three bytes more than a Byte variable. However, I always try to use Long wherever possible for performance reasons, as it's the native data type on a 32 bit processor.

It's really just a matter of personal preference, I suppose.
Apr 2 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.