|
From: Fran on 27 Jul 2008 19:36 Hi people I've just tried to run the following code in VB 6 ... Private Sub_Form_Load() With lstMonth ..AddItem "January" 'Items cannot be added at design time ..AddItem "February" ' must be added at run time ..AddItem "March" ..AddItem "April" ..AddItem "May" ..AddItem "June" ..AddItem "July" ..AddItem "August" ..AddItem "September" ..AddItem "October" ..AddItem "November" ..AddItem "December" ..ListIndex = 0 'set default selected month to January End With End Sub In an attempt to add items to a list box named "lstMonth". When I try to run the procedure, I get "invalid outside procedure" as the message. Can anyone suggest what I'm doing wrong, or is this some sort of strange run time error? The curious thing is that when I ran a test as follows: Private Sub_Form_Load() lstNames.AddItem "Joe Bloggs" End Sub for a list box named "lstNames" it works fine. Any ideas what is going on? Fran
From: Bob Butler on 27 Jul 2008 19:45 "Fran" <Fran.Beta(a)gmail.com> wrote in message news:e8aa840b-a7da-4147-9e75-480c91bad96b(a)v26g2000prm.googlegroups.com... > Hi people > > I've just tried to run the following code in VB 6 ... > > > Private Sub_Form_Load() Lose the underscore between Sub and Form Private Sub Form_Load()
From: Patrick Weidener on 27 Jul 2008 19:46 The procedure is called Private Sub Form_Load() and not Private Sub_Form_Load()
From: Jeff Johnson on 28 Jul 2008 01:34 "Fran" <Fran.Beta(a)gmail.com> wrote in message news:e8aa840b-a7da-4147-9e75-480c91bad96b(a)v26g2000prm.googlegroups.com... > .AddItem "January" 'Items cannot be added at design time Yes they can. I believe the List property is what you use. I'm not advocating that you do this--I personally always populate list boxes through code--but I want to mention that it CAN be done at design time.
From: Fran on 28 Jul 2008 05:15 On Jul 28, 9:46 am, Patrick Weidener <pawei_nos...(a)gmx.net> wrote: > The procedure is called > > Private Sub Form_Load() > > and not > > Private Sub_Form_Load() Thanks Sometimes things can be in plain sight without one seeing them I'll let you know Fran
|
Next
|
Last
Pages: 1 2 3 4 5 6 Prev: ACREDITE FUNCIONA!!!!! Next: ListView control: Selecting only the text |