Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Setting focus on User Form Listbox

I have a Listbox on a User Form. Another form has gotten the user's
selection. I then transfer their selection to this Listbox with:

lbxTerr.Selected(i) = True

But the focus inside the Listbox is still on the first item. This isn't a
big deal, but I'd rather not have the faint dashed line around the first
selection. So what puts the focus on the item that I just set to true?

Don <www.donwiss.com (e-mail link at home page bottom).
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Setting focus on User Form Listbox

Maybe...
lbxTerr.topindex = i
or maybe
lbxOtherLB.topindex = lbxTerr.topindex



Don Wiss wrote:

I have a Listbox on a User Form. Another form has gotten the user's
selection. I then transfer their selection to this Listbox with:

lbxTerr.Selected(i) = True

But the focus inside the Listbox is still on the first item. This isn't a
big deal, but I'd rather not have the faint dashed line around the first
selection. So what puts the focus on the item that I just set to true?

Don <www.donwiss.com (e-mail link at home page bottom).


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Setting focus on User Form Listbox

On Thu, 24 Aug 2006, Dave Peterson wrote:

Don Wiss wrote:
I have a Listbox on a User Form. Another form has gotten the user's
selection. I then transfer their selection to this Listbox with:

lbxTerr.Selected(i) = True

But the focus inside the Listbox is still on the first item. This isn't a
big deal, but I'd rather not have the faint dashed line around the first
selection. So what puts the focus on the item that I just set to true?


Maybe...
lbxTerr.topindex = i


I tried this. While it didn't move the focus, it did bring into view the
selection when it was not in view. So it was a very useful addition. I
ended up not running it when the selection was in view. I could have, and
that would have pushed the faint dashed line out of view.

or maybe
lbxOtherLB.topindex = lbxTerr.topindex


I didn't figure out just what this suggestion was.

I communicated a bit with the support place my company hires. He determined
it would require APIs and finding the handle. Way overkill for what is
basically a cosmetic issue.

Don <www.donwiss.com (e-mail link at home page bottom).
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Setting focus on User Form Listbox

or maybe
lbxOtherLB.topindex = lbxTerr.topindex


I didn't figure out just what this suggestion was.

If lbxTerr showed element N, I thought that maybe you wanted to have your other
listbox (delightfully named lbxOtherLB) to show the same.



Don Wiss wrote:
<<snipped
--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 300
Default Setting focus on User Form Listbox

On Fri, 25 Aug 2006, Dave Peterson wrote:

or maybe
lbxOtherLB.topindex = lbxTerr.topindex


I didn't figure out just what this suggestion was.

If lbxTerr showed element N, I thought that maybe you wanted to have your other
listbox (delightfully named lbxOtherLB) to show the same.


There is no other listbox. The zip code selection form has closed and it
passes the state and territory to the main form. State is a combo box. A
change event on it populates the territory listbox. Then it selects the
territory that the entered zip code falls into.

Don <www.donwiss.com (e-mail link at home page bottom).
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
set focus on user form jhahes[_2_] Excel Programming 1 June 1st 05 09:26 PM
User Form focus Glen Mettler[_2_] Excel Programming 3 October 10th 04 05:31 PM
Modeless User Form and Worksheet Focus JWolf Excel Programming 2 May 26th 04 08:27 PM
Setting form controls focus and enter key John T Ingato Excel Programming 1 October 6th 03 05:13 PM
Text Box on User Form Set Focus Issue John Flynn Excel Programming 0 September 6th 03 02:41 PM


All times are GMT +1. The time now is 04:18 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"