UGN Security Forums
My ProfileMember DirectoryLogin
Search our ForumsView our FAQView our Site Rules
View our CalendarView our Active TopicsGo to our Main Page

UGN Security Store
 

Network Sites UGN Security, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
Our Sponsors

Latest Postings
Owning Servers
by Gizmo
08/30/08 07:20 AM
my old account still exists!
by Gizmo
08/19/08 02:27 PM
Burger King gone Wild!
by Gizmo
08/08/08 11:42 PM
PDX 2600
by rbcp
08/07/08 12:46 AM
The Pirate Bay- shut down?
by ZER0_DECEPTION
08/05/08 09:07 PM
Windows Events for Changing Access rights to a folder or a File
by Gizmo
08/05/08 12:32 PM
question about IE and CSS
by §intå×
08/04/08 08:51 PM
Server
by Gizmo
08/01/08 01:29 AM
Topic Options
#17546 - 10/17/03 12:06 PM SetFocus
UndeadBob Offline
Junior Member

Registered: 06/11/02
Posts: 62
Loc: UK
hey all,

my first VB assignment at uni works fine except for one thing. When the program starts it runs until it gets to SetFocus and then gives me a Run time error '5' an invalid procedure call or argument.

Code:
 Private Sub Form_Load()
    optBackColour1.Value = True
    optTextColour1.Value = True
    optFont1.Value = True
    optPointSize1.Value = True
    txtStyles.SetFocus
End Sub

Private Sub optBackColour1_Click()
    txtStyles.BackColor = &HFFFFFF
    txtStyles.SetFocus
End Sub 
when it starts it reads the Form_Load code and skips to the optBackColour1_Click sub be qives me the error when it gets to txtStyles.SetFocus

any help will be appreciated.....
_________________________
"Mrs. Jones, I'm sorry to inform you, but we've run the tests, and it appears that you have XP. Now don't cry - it's bad, but it's not a death sentence. Modern science has advanced in recent years, and it's now possible to live a reasonably happy life with XP. And there's a survivor's group that you'll want to meet as well."

Top
Our Sponsors
Sponsor Our Sponsors

Top  
#17547 - 10/18/03 01:18 AM Re: SetFocus
SilentRage Offline
DollarDNS Owner

Registered: 03/04/02
Posts: 1273
Loc: OH, USA
The moment I saw the title "SetFocus" I just knew what the question would be. There's only one error I've ever gotten with SetFocus and that is when you're trying to give a control Focus when it isn't visible. The Form_Load event fires before the Form_Activate event and therefor is not visible at the time.
_________________________
Domain Registration, Hosting, Management
http://www.dollardns.net

Top
#17548 - 10/18/03 09:19 PM Re: SetFocus
BackSlash Offline
UGN's Resident Homo

Registered: 03/16/02
Posts: 599
Loc: TN
you can put in form1.show before the setfocus, that should fix it
_________________________
"It's better to burn out, than to fade away."

Top
#17549 - 10/19/03 12:40 AM Re: SetFocus
UndeadBob Offline
Junior Member

Registered: 06/11/02
Posts: 62
Loc: UK
thanx guys for your help. it was bugging me beause i just couldn't see what was wrong
_________________________
"Mrs. Jones, I'm sorry to inform you, but we've run the tests, and it appears that you have XP. Now don't cry - it's bad, but it's not a death sentence. Modern science has advanced in recent years, and it's now possible to live a reasonably happy life with XP. And there's a survivor's group that you'll want to meet as well."

Top



Forum Stats
6911 Members
44 Forums
10465 Topics
45205 Posts

Max Online: 677 @ 06/30/07 10:06 PM
Top Posters
Gizmo 6930
UGN Security 3441
§intå× 3250
IceMyst 1449
SilentRage 1273
Ice 1146
pergesu 1134
Infinite 1039
jonconley 954
Girlie 903
Newest Members
red queen, byopc, cybermox, NiPah, mcscrwdy25
6911 Registered Users
Who's Online
1 Registered (Gizmo), 10 Guests and 7 Spiders online.
Key: Admin, Global Mod, Mod
Latest News
Update Humpday - Aug 27, 2008
by Gizmo
08/28/08 12:58 AM
Update Humpday - Aug 20, 2008
by Gizmo
08/21/08 01:48 AM
Update Humpday - Aug 14, 2008
by Gizmo
08/14/08 08:33 AM
Update Humpday - Aug 06, 2008
by Gizmo
08/06/08 08:05 AM
Update Humpday - Jul 30th, 2008
by Gizmo
07/31/08 11:17 AM


Donate

Get the Google FireFox Toolbar
Get Firefox!
Get FireFox!