ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How Do I Get SetFocus On A ComboBox In A Frame? (https://www.excelbanter.com/excel-programming/315853-how-do-i-get-setfocus-combobox-frame.html)

Minitman[_4_]

How Do I Get SetFocus On A ComboBox In A Frame?
 
Greetings,

I have 2 TextBoxes followed by a Frame with a ComboBox in it and
finally a "Save" button. I have the tab stops set to true and the tab
order is as follows:

TextBox1 = 0
TextBox2 = 1
Frame1 = 2
Save button = 3

On the Frame the ComboBox has the tab stop on and tab order is set to
0.

mangesh_yadav[_155_]

How Do I Get SetFocus On A ComboBox In A Frame?
 

It should work. Just re-check. Its possible that the tabstop is fals
for your frame.

- Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27554


Minitman[_4_]

How Do I Get SetFocus On A ComboBox In A Frame?
 
Hey Mangesh,

Just checked again, it's set to true and tab order is set to 2. when
I use this:

ComboBox1.SetFocus

I get this error message:

Run-time error '2147418113 (8000ffff):
Unexpected call to method or property access.

Does this shed any light on the problem?

I just don't understand it!!!

-Minitman


On Fri, 5 Nov 2004 00:49:24 -0600, mangesh_yadav
wrote:


It should work. Just re-check. Its possible that the tabstop is false
for your frame.

- Mangesh



mangesh_yadav[_156_]

How Do I Get SetFocus On A ComboBox In A Frame?
 

When do you get the error. When you open the UserForm or when you ope
the excel file you get the run-time error...?

And where have you placed the code Combobox1.SetFocus?

Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27554


Minitman[_4_]

How Do I Get SetFocus On A ComboBox In A Frame?
 
Hey Mangesh,

I open UserForm1, I load TextBox1 and enter to TextBox2. When I exit
TextBox2, Frame1 becomes visible and the error pops up. CBox1 is
inside Frame1. If I rem out (use an ') CBox1.SetFocus, the focus goes
instead to the "Save" button.

Here is the code that fires upon exiting TextBox2:

Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
BankFrame.Visible = True
CBox1.SetFocus
<Snip
End Sub

Thank you for looking at this and any suggestion you may offer.

-Minitman


On Fri, 5 Nov 2004 03:08:27 -0600, mangesh_yadav
wrote:


When do you get the error. When you open the UserForm or when you open
the excel file you get the run-time error...?

And where have you placed the code Combobox1.SetFocus?

Mangesh



mangesh_yadav[_157_]

How Do I Get SetFocus On A ComboBox In A Frame?
 

I agree its quite wierd. But maybe you can try the following:

from your first post....

TextBox1 = 0
TextBox2 = 1
Frame1 = 3
Save button = 2

note that, for the frame, i have kept the TabIndex 3, and the butto
has 2 (interchanged both).

Now your exit event should be....

Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
BankFrame.Visible = True
BankFrame.SetFocus
<Snip
End Sub

Hopefully this works...

- Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27554



All times are GMT +1. The time now is 07:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com