Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default form problem

I have this as part of a form. When I run the form from a program, if I just
accept the form defaults, the value for listbox2 is "LIVE" and listbox3 is
"".
In the Tab Order for the form, Listbox 2 is above Listbox3.
If I change this order in the Tab Order then in the program, listbox2 is ""
and listbox3 is "LONG".
Can anyone tell me what is causing this behaviour please? I want both
listboxes to contain the default values when the form is exited.

I am using excel xp

Thanks

Chris

Private Sub UserForm_initialize()
Dim d1 As String
TextBox1.Value = 30
TextBox4.Value = 90
TextBox18.Value = 20
TextBox24.Value = 30
ListBox2.AddItem "LIVE"
ListBox2.AddItem "BACKTEST"
ListBox2.ListIndex = 0
ListBox3.AddItem "LONG"
ListBox3.AddItem "SHORT"
ListBox3.ListIndex = 0
TextBox3.Visible = False
TextBox10.Visible = False
TextBox27.Visible = False
Label32.Visible = False
Label6.Visible = False
ListBox2.Value = "LIVE"
ListBox3.Value = "LONG"

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default form problem

Perhaps you have event code associated with the listboxes which is being
fired.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...
I have this as part of a form. When I run the form from a program, if I

just
accept the form defaults, the value for listbox2 is "LIVE" and listbox3 is
"".
In the Tab Order for the form, Listbox 2 is above Listbox3.
If I change this order in the Tab Order then in the program, listbox2 is

""
and listbox3 is "LONG".
Can anyone tell me what is causing this behaviour please? I want both
listboxes to contain the default values when the form is exited.

I am using excel xp

Thanks

Chris

Private Sub UserForm_initialize()
Dim d1 As String
TextBox1.Value = 30
TextBox4.Value = 90
TextBox18.Value = 20
TextBox24.Value = 30
ListBox2.AddItem "LIVE"
ListBox2.AddItem "BACKTEST"
ListBox2.ListIndex = 0
ListBox3.AddItem "LONG"
ListBox3.AddItem "SHORT"
ListBox3.ListIndex = 0
TextBox3.Visible = False
TextBox10.Visible = False
TextBox27.Visible = False
Label32.Visible = False
Label6.Visible = False
ListBox2.Value = "LIVE"
ListBox3.Value = "LONG"

End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default form problem

Tom
Could you offer some more help please? I don't understand what you have
said.
Thanks
Chris

"Tom Ogilvy" wrote in message
...
Perhaps you have event code associated with the listboxes which is being
fired.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...
I have this as part of a form. When I run the form from a program, if I

just
accept the form defaults, the value for listbox2 is "LIVE" and listbox3

is
"".
In the Tab Order for the form, Listbox 2 is above Listbox3.
If I change this order in the Tab Order then in the program, listbox2 is

""
and listbox3 is "LONG".
Can anyone tell me what is causing this behaviour please? I want both
listboxes to contain the default values when the form is exited.

I am using excel xp

Thanks

Chris

Private Sub UserForm_initialize()
Dim d1 As String
TextBox1.Value = 30
TextBox4.Value = 90
TextBox18.Value = 20
TextBox24.Value = 30
ListBox2.AddItem "LIVE"
ListBox2.AddItem "BACKTEST"
ListBox2.ListIndex = 0
ListBox3.AddItem "LONG"
ListBox3.AddItem "SHORT"
ListBox3.ListIndex = 0
TextBox3.Visible = False
TextBox10.Visible = False
TextBox27.Visible = False
Label32.Visible = False
Label6.Visible = False
ListBox2.Value = "LIVE"
ListBox3.Value = "LONG"

End Sub






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default form problem

The code you show should not create the problem that you describe. If you
created events associated with the comboboxes, perhaps this code is causing
your problem.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...
Tom
Could you offer some more help please? I don't understand what you have
said.
Thanks
Chris

"Tom Ogilvy" wrote in message
...
Perhaps you have event code associated with the listboxes which is being
fired.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...
I have this as part of a form. When I run the form from a program, if

I
just
accept the form defaults, the value for listbox2 is "LIVE" and

listbox3
is
"".
In the Tab Order for the form, Listbox 2 is above Listbox3.
If I change this order in the Tab Order then in the program, listbox2

is
""
and listbox3 is "LONG".
Can anyone tell me what is causing this behaviour please? I want both
listboxes to contain the default values when the form is exited.

I am using excel xp

Thanks

Chris

Private Sub UserForm_initialize()
Dim d1 As String
TextBox1.Value = 30
TextBox4.Value = 90
TextBox18.Value = 20
TextBox24.Value = 30
ListBox2.AddItem "LIVE"
ListBox2.AddItem "BACKTEST"
ListBox2.ListIndex = 0
ListBox3.AddItem "LONG"
ListBox3.AddItem "SHORT"
ListBox3.ListIndex = 0
TextBox3.Visible = False
TextBox10.Visible = False
TextBox27.Visible = False
Label32.Visible = False
Label6.Visible = False
ListBox2.Value = "LIVE"
ListBox3.Value = "LONG"

End Sub








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default form problem


The form is called from a program:

elliottInput.Show
The only wat to exit the form is via a button:

Private Sub CommandButton1_Click()
bOK = True
Me.Hide
End Sub

immediately after this in the calling program, I set some variables
string2 = elliottInput.ListBox2.Value
string3= elliottInput.ListBox3.Value

Unless the values in the listboxes have been explicity set by the form,
either string2 or string3 ="" when I need them both to have the default
values in the listbox.
Chris



"Tom Ogilvy" wrote in message
...
The code you show should not create the problem that you describe. If you
created events associated with the comboboxes, perhaps this code is

causing
your problem.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...
Tom
Could you offer some more help please? I don't understand what you have
said.
Thanks
Chris

"Tom Ogilvy" wrote in message
...
Perhaps you have event code associated with the listboxes which is

being
fired.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...
I have this as part of a form. When I run the form from a program,

if
I
just
accept the form defaults, the value for listbox2 is "LIVE" and

listbox3
is
"".
In the Tab Order for the form, Listbox 2 is above Listbox3.
If I change this order in the Tab Order then in the program,

listbox2
is
""
and listbox3 is "LONG".
Can anyone tell me what is causing this behaviour please? I want

both
listboxes to contain the default values when the form is exited.

I am using excel xp

Thanks

Chris

Private Sub UserForm_initialize()
Dim d1 As String
TextBox1.Value = 30
TextBox4.Value = 90
TextBox18.Value = 20
TextBox24.Value = 30
ListBox2.AddItem "LIVE"
ListBox2.AddItem "BACKTEST"
ListBox2.ListIndex = 0
ListBox3.AddItem "LONG"
ListBox3.AddItem "SHORT"
ListBox3.ListIndex = 0
TextBox3.Visible = False
TextBox10.Visible = False
TextBox27.Visible = False
Label32.Visible = False
Label6.Visible = False
ListBox2.Value = "LIVE"
ListBox3.Value = "LONG"

End Sub












  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default form problem

I don't see anything in your code that would cause the problem you describe.
Setting the variables in the calling program occurs after the form is shown.
I load listboxes in the Initialize event all the time and have never had a
problem with it.

I built a userform with all your controls (shown in the code you have
posted) and copied the code straight from your email and it all worked fine
for me, even changing the tab order as you describe.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...

The form is called from a program:

elliottInput.Show
The only wat to exit the form is via a button:

Private Sub CommandButton1_Click()
bOK = True
Me.Hide
End Sub

immediately after this in the calling program, I set some variables
string2 = elliottInput.ListBox2.Value
string3= elliottInput.ListBox3.Value

Unless the values in the listboxes have been explicity set by the form,
either string2 or string3 ="" when I need them both to have the default
values in the listbox.
Chris



"Tom Ogilvy" wrote in message
...
The code you show should not create the problem that you describe. If

you
created events associated with the comboboxes, perhaps this code is

causing
your problem.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...
Tom
Could you offer some more help please? I don't understand what you

have
said.
Thanks
Chris

"Tom Ogilvy" wrote in message
...
Perhaps you have event code associated with the listboxes which is

being
fired.

--
Regards,
Tom Ogilvy


"inquirer" wrote in message
...
I have this as part of a form. When I run the form from a program,

if
I
just
accept the form defaults, the value for listbox2 is "LIVE" and

listbox3
is
"".
In the Tab Order for the form, Listbox 2 is above Listbox3.
If I change this order in the Tab Order then in the program,

listbox2
is
""
and listbox3 is "LONG".
Can anyone tell me what is causing this behaviour please? I want

both
listboxes to contain the default values when the form is exited.

I am using excel xp

Thanks

Chris

Private Sub UserForm_initialize()
Dim d1 As String
TextBox1.Value = 30
TextBox4.Value = 90
TextBox18.Value = 20
TextBox24.Value = 30
ListBox2.AddItem "LIVE"
ListBox2.AddItem "BACKTEST"
ListBox2.ListIndex = 0
ListBox3.AddItem "LONG"
ListBox3.AddItem "SHORT"
ListBox3.ListIndex = 0
TextBox3.Visible = False
TextBox10.Visible = False
TextBox27.Visible = False
Label32.Visible = False
Label6.Visible = False
ListBox2.Value = "LIVE"
ListBox3.Value = "LONG"

End Sub












Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Repaint Problem ybazizi Excel Discussion (Misc queries) 0 January 18th 06 05:32 PM
User Form Problem DCSwearingen Excel Discussion (Misc queries) 2 December 30th 05 03:42 PM
User Form Problem DCSwearingen Excel Discussion (Misc queries) 0 December 29th 05 11:04 PM
DATA FORM problem saziz[_4_] Excel Programming 12 June 13th 04 01:30 PM
problem with user form chris[_3_] Excel Programming 1 July 15th 03 03:40 AM


All times are GMT +1. The time now is 10:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"