UGN Security


Posted By: UndeadBob

SetFocus - 10/17/03 04:06 PM

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.

 Private Sub Form_Load()
    optBackColour1.Value = True
    optTextColour1.Value = True
    optFont1.Value = True
    optPointSize1.Value = True
End Sub

Private Sub optBackColour1_Click()
    txtStyles.BackColor = &HFFFFFF
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.....
Posted By: SilentRage

Re: SetFocus - 10/18/03 05:18 AM

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.
Posted By: BackSlash

Re: SetFocus - 10/19/03 01:19 AM

you can put in before the setfocus, that should fix it
Posted By: UndeadBob

Re: SetFocus - 10/19/03 04:40 AM

thanx guys for your help. it was bugging me beause i just couldn't see what was wrong
© 2018 UGN Security Forum