473,804 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listbox gotfocus error that is driving me mad

Jim
I really hope someone can help me with the below problem. It's driving
me insane.

I have a form with two combo boxes (say, combo1 and combo2) and a list
box (listbox1). When the user selects a value in combo1, the
AfterUpdate event kicks in, does some stuff, and moves focus to
combo2. The code looks something like this:

Private Sub combo1_AfterUpd ate
'do stuff
combo2.SetFocus
End Sub

However, when the debugger gets to the line combo2.SetFocus , it goes
off and runs listbox1_GotFoc us (which has its own sub that i do not
want running).

There is simply no reference anywhere to call this sub and I it's
really starting to baffle me. I've tried deleting and readding the
controls, amongst other things, and I can only assume it's yet another
Microsoft bug.

Any help would be greatly appreciated

Jim
Nov 12 '05 #1
7 2061
goto your code module and do a Find (ctrl H) for every occurence of
"combo2" (or the actual name of your 2nd combobox). By default, the
Find (replace) dialog box is set to look in the current module. Just
type combo2 (or rather the actual name of your combobox) and click on
Find/Find Next. You may have sub for the Enter event or GotFocus Event
for combo2 which is telling it to setfocus to your listbox as soon as
combo2 gets the focus. If that isn't it, then try Repair/Compacting
your database. If that doesn't do it then I would create a new form and
copy all your stuff over to it minus the listbox and run the form. If
there is a problem you will get an error. Note: I would copy your
stuff to a new form for safety and do your testing on the new form. I
do this all the time. When ever you test something, always test the
copy.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #2
first try to remark all "staff", leave only setfocus, and see if it start
working
if no - then try to post all code from your form here

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
"Jim" <js*****@hotmai l.com> wrote in message
news:5c******** *************** ***@posting.goo gle.com...
I really hope someone can help me with the below problem. It's driving
me insane.

I have a form with two combo boxes (say, combo1 and combo2) and a list
box (listbox1). When the user selects a value in combo1, the
AfterUpdate event kicks in, does some stuff, and moves focus to
combo2. The code looks something like this:

Private Sub combo1_AfterUpd ate
'do stuff
combo2.SetFocus
End Sub

However, when the debugger gets to the line combo2.SetFocus , it goes
off and runs listbox1_GotFoc us (which has its own sub that i do not
want running).

There is simply no reference anywhere to call this sub and I it's
really starting to baffle me. I've tried deleting and readding the
controls, amongst other things, and I can only assume it's yet another
Microsoft bug.

Any help would be greatly appreciated

Jim

Nov 12 '05 #3
Jim
Alex

Thanks for your reply. There are no other events, and no references
whatsoever to the combos or listboxes anywhere in the code.

Jim

"Alex Dybenko" <al**@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message
news:O9******** ********@TK2MSF TNGP12.phx.gbl. ..
first try to remark all "staff", leave only setfocus, and see if it start
working
if no - then try to post all code from your form here

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
"Jim" <js*****@hotmai l.com> wrote in message
news:5c******** *************** ***@posting.goo gle.com...
I really hope someone can help me with the below problem. It's driving
me insane.

I have a form with two combo boxes (say, combo1 and combo2) and a list
box (listbox1). When the user selects a value in combo1, the
AfterUpdate event kicks in, does some stuff, and moves focus to
combo2. The code looks something like this:

Private Sub combo1_AfterUpd ate
'do stuff
combo2.SetFocus
End Sub

However, when the debugger gets to the line combo2.SetFocus , it goes
off and runs listbox1_GotFoc us (which has its own sub that i do not
want running).

There is simply no reference anywhere to call this sub and I it's
really starting to baffle me. I've tried deleting and readding the
controls, amongst other things, and I can only assume it's yet another
Microsoft bug.

Any help would be greatly appreciated

Jim


Nov 12 '05 #4
well, in this case i can just suggest to recreate form again
--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
"Jim" <ji**********@n ospam.virgin.ne t> wrote in message
news:2tv_b.1296 $ta.1114@newsfe 1-win...
Alex

Thanks for your reply. There are no other events, and no references
whatsoever to the combos or listboxes anywhere in the code.

Jim

"Alex Dybenko" <al**@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message
news:O9******** ********@TK2MSF TNGP12.phx.gbl. ..
first try to remark all "staff", leave only setfocus, and see if it start working
if no - then try to post all code from your form here

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
"Jim" <js*****@hotmai l.com> wrote in message
news:5c******** *************** ***@posting.goo gle.com...
I really hope someone can help me with the below problem. It's driving
me insane.

I have a form with two combo boxes (say, combo1 and combo2) and a list
box (listbox1). When the user selects a value in combo1, the
AfterUpdate event kicks in, does some stuff, and moves focus to
combo2. The code looks something like this:

Private Sub combo1_AfterUpd ate
'do stuff
combo2.SetFocus
End Sub

However, when the debugger gets to the line combo2.SetFocus , it goes
off and runs listbox1_GotFoc us (which has its own sub that i do not
want running).

There is simply no reference anywhere to call this sub and I it's
really starting to baffle me. I've tried deleting and readding the
controls, amongst other things, and I can only assume it's yet another
Microsoft bug.

Any help would be greatly appreciated

Jim



Nov 12 '05 #5
Jim
That helps. I'll put it down to an MS bug.

Thanks
Jim

"Alex Dybenko" <al**@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message news:<u4******* *******@TK2MSFT NGP09.phx.gbl>. ..
well, in this case i can just suggest to recreate form again
--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
"Jim" <ji**********@n ospam.virgin.ne t> wrote in message
news:2tv_b.1296 $ta.1114@newsfe 1-win...
Alex

Thanks for your reply. There are no other events, and no references
whatsoever to the combos or listboxes anywhere in the code.

Jim

"Alex Dybenko" <al**@PLEASE.ce mi.NO.rssi.SPAM .ru> wrote in message
news:O9******** ********@TK2MSF TNGP12.phx.gbl. ..
first try to remark all "staff", leave only setfocus, and see if it start working
if no - then try to post all code from your form here

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
"Jim" <js*****@hotmai l.com> wrote in message
news:5c******** *************** ***@posting.goo gle.com...
> I really hope someone can help me with the below problem. It's driving
> me insane.
>
> I have a form with two combo boxes (say, combo1 and combo2) and a list
> box (listbox1). When the user selects a value in combo1, the
> AfterUpdate event kicks in, does some stuff, and moves focus to
> combo2. The code looks something like this:
>
> Private Sub combo1_AfterUpd ate
> 'do stuff
> combo2.SetFocus
> End Sub
>
> However, when the debugger gets to the line combo2.SetFocus , it goes
> off and runs listbox1_GotFoc us (which has its own sub that i do not
> want running).
>
> There is simply no reference anywhere to call this sub and I it's
> really starting to baffle me. I've tried deleting and readding the
> controls, amongst other things, and I can only assume it's yet another
> Microsoft bug.
>
> Any help would be greatly appreciated
>
> Jim


Nov 12 '05 #6

"wuqiang" <wu*****@hotmai l.com> ????
news:5c******** *************** ***@posting.goo gle.com...
I really hope someone can help me with the below problem. It's driving
me insane.

I have a form with two combo boxes (say, combo1 and combo2) and a list
box (listbox1). When the user selects a value in combo1, the
AfterUpdate event kicks in, does some stuff, and moves focus to
combo2. The code looks something like this:

Private Sub combo1_AfterUpd ate
'do stuff
combo2.SetFocus
End Sub

However, when the debugger gets to the line combo2.SetFocus , it goes
off and runs listbox1_GotFoc us (which has its own sub that i do not
want running).

There is simply no reference anywhere to call this sub and I it's
really starting to baffle me. I've tried deleting and readding the
controls, amongst other things, and I can only assume it's yet another
Microsoft bug.

Any help would be greatly appreciated

wuqiang

Nov 12 '05 #7

"wuqiang" <wu*****@hotmai l.com> ????
news:5c******** *************** ***@posting.goo gle.com...
I really hope someone can help me with the below problem. It's driving
me insane.

I have a form with two combo boxes (say, combo1 and combo2) and a list
box (listbox1). When the user selects a value in combo1, the
AfterUpdate event kicks in, does some stuff, and moves focus to
combo2. The code looks something like this:

Private Sub combo1_AfterUpd ate
'do stuff
combo2.SetFocus
End Sub

However, when the debugger gets to the line combo2.SetFocus , it goes
off and runs listbox1_GotFoc us (which has its own sub that i do not
want running).

There is simply no reference anywhere to call this sub and I it's
really starting to baffle me. I've tried deleting and readding the
controls, amongst other things, and I can only assume it's yet another
Microsoft bug.

Any help would be greatly appreciated

wuqiang

Nov 12 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6812
by: (Pete Cresswell) | last post by:
Seems like I've been here before, but can't find anyting in Google. I've got two list boxes on a form. Seems to me like the inactive ListBox's selection rectangle should be something like gray...otherwise, the user sees two ListBoxes, both with black selection rectangles - and the user does not visually know which one he is "in". This becomes relevant if we have a keyboard-type user - they want to hit "Enter" and have something...
3
5310
by: Alan Lane | last post by:
Hello world: I have a Parent form with a combobox, where the user selects a Contract or Estimate number. Then, on a subform, I have a listbox that gets filled with the details of the selected Contract. The subform listbox shows 21 rows. That has been fine, but now we are starting to get some Contracts or Estimates with more than 21 items.
18
2028
by: Dave Sauny | last post by:
Ok, its a friday, I'm at work and I cant get this to work: I have 3 listboxes on one tab control page. when i select an item in listbox1 i want whatever is selected on the other 2 listboxes unselected. when listbox2 is selected, 1 and 3 should have no items selected and the same with listbox 3. Sounds simple... should be simple! I have tried listbox.clearselected(), listbox.selectedindex=-1 and beating it with a large stick. But so...
4
1525
by: Boni | last post by:
Dear all, is it possible to determine if a particular control (i.e. Listbox) has focus, without implementing gotfocus/lostfocus? I can't find such property. P.S I know that I can implement such property, with gotfocus/lostfocus, but may be there is a better way?
0
9593
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9169
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7633
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.