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 8375485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:11:23+00:00 2026-06-09T15:11:23+00:00

i wonder what is wrong with the following vb.net code. Public Class Form10 Public

  • 0

i wonder what is wrong with the following vb.net code.

Public Class Form10

Public IDs() As String = TextBox1.Text.Split(",")

Private Sub Form10_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    For Each id In IDs
        MsgBox(id)
    Next
End Sub

End Class

when i do

Form10.show()

i get an error “Object reference not set to an instance”

  • 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-09T15:11:25+00:00Added an answer on June 9, 2026 at 3:11 pm

    You have declared a field in your class to be initialized with a value from a control on the corresponding form that does not yet exist. The control is not initialized and loaded by the time your initializer on your field member is accessed, thus causing the error.

    To keep the public IDs declaration, you could remove the initialization from the field declaration, then move the assignment to the Button1_Click event, as follows:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        IDs=TextBox1.Text.Split(",")
        ' Do something interesting with IDs now...
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a string concatenation code. I wonder what is wrong
wonder what's wrong <table id=tblDomainVersion> <tr> <td>Version</td> <td>No of sites</td> </tr> <tr> <td class=clsversion>1.25</td>
I wonder if there is something wrong with the copy constructor function below? class
I am using Jena 2.6.4. The following code String v = Parnell Square East;
I'm trying to digitally sign a MultiMIME message using the following code. I wonder
The following code fails on my install of PHP 5.3.6-13ubuntu3.2 which makes me wonder
I have following textbox in my first HTML page: <input tabindex=4 type=text class=search_textbox roundedCorners
wonder whether someone can help me with the following one... I have a struct
I wonder how can i accomplish the following: I would like to display the
I wonder what is wrong with this? .h file: typedef enum { N4LoupeTypeRound, N4LoupeTypeRectangle,

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.