If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Loop

Looks OK to me (though I didn't really read through the SQL part in much detail). Yes, you should definitely be able to shorten the second one. Mostly like (you can check for bugs, just doing it off the top of my head, based on your code):

numberCB = 0;
while( cb_recipients[numberCB].Visible )
{
numberCB++;
}
numberCB--; //This is for compatibility with what you wrote; do you have an off-by-one-error?
//Or do you really want that?

Though, I think it would be better to not infer the value of numberCB based on visibility of the ComboBoxes. It'd be better (from a style perspective) to keep track of how many are visible as you set/unset them. In general, I try to avoid inferring anything from the GUI I don't absolutely have to (for example, reading user input is OK). It will wok just fine, as written, but GUIs have a tendency to change and it makes your code a little more brittle.

Best Regards,

BioPhysEngrhttp://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.