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, The GoNix Initiative, Elite Web Gamers, Back of the Web, EveryDay Helper, VNC Web Design & Development
December
Su M Tu W Th F Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Sponsored Links
Latest Postings
Latest Reviews
Topic Options
Rate This Topic
#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
Sponsored Links
      
#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

Featured Member
Registered: 10/28/14
Posts: 1
Forum Stats
2152 Members
46 Forums
36163 Topics
71333 Posts

Max Online: 1567 @ 04/25/10 05:20 AM
Top Posters
UGN Security 29324
Gremelin 7193
§intå× 3255
SilentRage 1273
Ice 1146
pergesu 1136
Infinite 1041
jonconley 955
Girlie 908
unreal 860
Newest Members
cdefgh368568, HushHush, golqm, Tim050, Gecko666
2151 Registered Users
Who's Online
0 registered (), 313 Guests and 351 Spiders online.
Key: Admin, Global Mod, Mod
Latest News


Donate
  Get Firefox!
Get FireFox!