By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,645 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

Onopen Onload form events

P: 121

I am trying to run a function when a form has been opened

The function changes the colour of some text boxes on the form

I have tried running the code on the onload, onopen, oncurrent event

these all run before the form is "actually" open and so my function is unable to change the colours of my text boxes

The function works fine when I run it via a button on the form but I need it to display the different colours when the user first opens the form

I am sure this is probably very simple and I am just missing something

Please Help

Regards Phill
Feb 15 '10 #1
Share this Question
Share on Google+
3 Replies

Expert 2.5K+
P: 3,532
We need to see the code, I guess, and maybe a plain English explanation of what you're trying to do. Also, what type of form are we talking about?

Linq ;0)>
Feb 15 '10 #2

P: 122
You should be able to change the properties of text boxes in any of those three events. Which one you want really depends on what exactly you are trying to do.

For example:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2.   MyTextBox.BorderColor = RGB(250, 0, 250)
  3.   MyTextBox.BackColor = RGB(250, 200, 250)
  4.   MyTextBox.ForeColor = RGB(100, 0, 100)
  5. End Sub
Feb 15 '10 #3

Expert Mod 100+
P: 2,321
Unless you have a OnCurrent event overwriting your format, the OnOpen, OnLoad or OnCurrent should work just fine.
Feb 15 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.