Event Load Alternative?

Posted on 2005-04-26
Last Modified: 2010-04-23
I am running an ActiveX control a 3rd party company created, that seems to "disable" all my load events such as little things like this:

Dim displayString As String
        displayString = Format(strdate, "MM/dd/yyyy")
        txtEntryDate.Text = displayString

Is there an alternative to the "Load" event to have things execute when the form opens other than the typical event?
Question by:chrisryhal
    LVL 96

    Expert Comment

    by:Bob Learned
    What do you mean by "Load" event?  Is this code in the Form_Load event, and it doesn't get run?

    LVL 9

    Expert Comment

    you can add the lines in the form constructor after the call to InitializeComponent()
    LVL 2

    Author Comment

    TheLearnedOne:  Yes, that is correct.  It seems that the ActiveX control allows everything to run BUT things in Form_Load.

    Checoo:  could you show me a fast example?
    LVL 9

    Accepted Solution

    when you create a new form the VS IDE will generate the following code --

    in sub new you will see a comment "Add any initialization after the InitializeComponent() call"
    you can write your code there.

    Public Class Form1
        Inherits System.Windows.Forms.Form

    #Region " Windows Form Designer generated code "

        Public Sub New()

            'This call is required by the Windows Form Designer.

            'Add any initialization after the InitializeComponent() call

            Dim displayString As String
            displayString = Format(strdate, "MM/dd/yyyy")
            txtEntryDate.Text = displayString

        End Sub

        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                End If
            End If
        End Sub

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            components = New System.ComponentModel.Container()
            Me.Text = "Form1"
        End Sub

    #End Region

    End Class
    LVL 2

    Author Comment


    Your suggestion worked.  I am always learning new things every day, thanks to you experts.  Thanks again.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now