Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9018861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:38:18+00:00 2026-06-16T04:38:18+00:00

At first I tried this: Public Class frmWait Public Sub New(ByVal uWindowText As String,

  • 0

At first I tried this:

Public Class frmWait

Public Sub New(ByVal uWindowText As String, ByVal uInfoText As String)

    Me.Text = uWindowText
    Me.lblInfoText.Text = uInfoText

End Sub

End Class

But when I initiated the form like this

            Dim wait As New frmWait("blah", "blah")
            wait.Show()

… it told me “NullReference Exception” at this line:

Me.lblInfoText.Text = uInfoText

Settings the form’s text worked fine.
Okay, I subspected the label was just not created yet when I tried to set the text.

Then I tried the following. I stored the texts in a variable and wanted to set them when the controls have been created. I thought “Form_Load” was a good event for that:

Public Class frmWait

Private m_sWindowText As String = ""
Private m_sInfoText As String = ""


Public Sub New(ByVal uWindowText As String, ByVal uInfoText As String)

    'we can not set the texts right away because lblInfo does not seem to exist yet

    m_sWindowText = uWindowText
    m_sInfoText = uInfoText

End Sub

Private Sub frmWait_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    Me.Text = m_sWindowText
    Me.lblInfoText.Text = m_sInfoText

End Sub

End Class

But it threw the same error.
Ehhhhh, when exactely can I set the control’s text?
Did I make any beginner’s mistake?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:38:19+00:00Added an answer on June 16, 2026 at 4:38 am

    Don’t delete what the designer does 🙂 It’s trying to help you. When you Create the

    Public Sub New(...)
    

    on a form, it will automatically put in :

    Public Sub New()
    
        ' This call is required by the designer.
        InitializeComponent()
    
        ' Add any initialization after the InitializeComponent() call.
    
    End Sub
    

    The InitializeComponent() is required to get the form ready for you to work with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Controller First I tried this: [HttpPost] public ActionResult Edit(JournalEntry journalentry) { if (ModelState.IsValid) {
I've tried this a couple ways, the first is have a class that implements
I have a code first application which defined like this: public abstract class Entity
I have tried this example http://www.bennadel.com/blog/1056-ColdFusion-CFPOP-My-First-Look.htm , but it retrieve emails from POP server.
This is the first Python script I've tried to create. I'm reading a xml
I tried to load my Array s like this, but it loads just first
this is my first time asking a question here. I tried to be well
First of all, sorry if this isn't an appropriate question for StackOverflow. I've tried
I had implement this push notification . I tried with push first message, it
Consider this example code: public class A<T> { public static T TheT { get;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.