Monday, May 24, 2010

2 simple questions about coding in visual basic 6?

my 1st question is about combo boxes.


i have 3 different combo boxes and i want them all to have the same items and i want to use the "with" function to add items





i tried:





with combo1 %26amp; combo2


.additem january


.additem e.t.c


End With





but that doesn't work, i've tried lots of variations with commas and + but none seem to work.





2nd prob:





how do you print out a whole bunch of things in different labels in a formatted way.

2 simple questions about coding in visual basic 6?
I don't know exactly how you plan to use the combo boxes, but a control array would let you do what you want.





Your boxes would be cboWhatever(1), cboWhatever(2), and cboWhatever(3).





If they all act the same, then you only have to code in the cboWhatever() sub and it applies to all 3.





As for you addItem, you add a For/Next loop, like:





for X = 1 to 3


With cboWhatever(x)


.additem january


.additem e.t.c


End With


Next





hope that helps





oh for the print question...you can use Printer.Print statements and there's formatting to go with it or you can use the VB reports. You need to ask that question again with more specifics
Reply:Here's what the help library says:


--------------------------------------...


Note Once a With block is entered, object can't be changed. As a result, you can't use a single With statement to affect a number of different objects.





You can nest With statements by placing one With block within another. However, because members of outer With blocks are masked within the inner With blocks, you must provide a fully qualified object reference in an inner With block to any member of an object in an outer With block.





Note In general, it's recommended that you don't jump into or out of With blocks. If statements in a With block are executed, but either the With or End With statement is not executed, a temporary variable containing a reference to the object remains in memory until you exit the procedure.


--------------------------------------...


So, given that, why not just use 3 with blocks?


And I don't understand the 2nd question





Sorry I can't be more help, I'm just learning as well.
Reply:You can get a freelancer to finish your assignment at


http://expert.myitcareer.org/


No comments:

Post a Comment