Todd_Anderson
asked on
What form event will do what I need?
VS 2005
VB
I have a form that I need to do certain things to when the user opens it. Once it is open one of the things a user can do from this form is pick a file using the standard file picker.
I am currently using the Activate event for the form to do the things that I needed to do at the begining. It was working great. Now that I have added the file picker I am having problem since Activate is firing when the user closes the file picker. The forms Load event wasn't working for me (it seemed like the controls were not ready for what I needed to do).
Is there an event that does what I am looking for?
Thanks,
Todd
VB
I have a form that I need to do certain things to when the user opens it. Once it is open one of the things a user can do from this form is pick a file using the standard file picker.
I am currently using the Activate event for the form to do the things that I needed to do at the begining. It was working great. Now that I have added the file picker I am having problem since Activate is firing when the user closes the file picker. The forms Load event wasn't working for me (it seemed like the controls were not ready for what I needed to do).
Is there an event that does what I am looking for?
Thanks,
Todd
Can you show us some codes?
ASKER
The first sub below is what I want to do when the user opens the form. The second is what happens when the user picks a file. I don't want the first one to fire when the user is done picking a file.
Private Sub FormConfigure_Activated(By Val sender As Object, ByVal e As System.EventArgs) Handles Me.Activated
'Fill the password text boxes since they are not bound to anything because of the encryption.
TextBoxDatabasePassword.Te xt = Decrypt(My.Settings.Databa sePassword )
TextBoxFTPPassword.Text = Decrypt(My.Settings.FTPPas sword)
'Select the first tab and the text in the first text field
TabControlConfigure.Select edTab = TabPageRetailer
Me.TextBoxRetailerNumber.F ocus()
Me.TextBoxRetailerNumber.S electAll()
End Sub
Private Sub ButtonDatabaseName_Click(B yVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonDatabaseName.Click
'Let the user pick the database file for their POS system
OpenFileDialogDatabaseName .Title = "Locate the database file"
OpenFileDialogDatabaseName .ShowDialo g()
TextBoxDatabaseName.Text = OpenFileDialogDatabaseName .FileName
'Add a tool tip to the database name textbox
ToolTipConfigure.SetToolTi p(TextBoxD atabaseNam e, OpenFileDialogDatabaseName .FileName)
End Sub
Private Sub FormConfigure_Activated(By
'Fill the password text boxes since they are not bound to anything because of the encryption.
TextBoxDatabasePassword.Te
TextBoxFTPPassword.Text = Decrypt(My.Settings.FTPPas
'Select the first tab and the text in the first text field
TabControlConfigure.Select
Me.TextBoxRetailerNumber.F
Me.TextBoxRetailerNumber.S
End Sub
Private Sub ButtonDatabaseName_Click(B
'Let the user pick the database file for their POS system
OpenFileDialogDatabaseName
OpenFileDialogDatabaseName
TextBoxDatabaseName.Text = OpenFileDialogDatabaseName
'Add a tool tip to the database name textbox
ToolTipConfigure.SetToolTi
End Sub
I think it is better to put this in the form_load()
Did you try putting it, at the end of the form load?
If error occurs, Please post the error.
Did you try putting it, at the end of the form load?
If error occurs, Please post the error.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
JackOfPH,
Your idea works great. I'm a little dissapointed that I couldn't get it figured out using an event but I'll get over it.
Thanks,
Todd
Your idea works great. I'm a little dissapointed that I couldn't get it figured out using an event but I'll get over it.
Thanks,
Todd