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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:49:18+00:00 2026-06-10T11:49:18+00:00

All i want to do is access my property from a parent Form in

  • 0

All i want to do is access my property from a parent Form in vb.net Forms.
but it won’t let me do

 Dim formParent1 As formParent

 Private Sub search()
 formParent1.propertyName = 1
 End Sub

but it gives an error at formParent1.propertyname = 1. Saying “Object reference not set to an instance of an object”.

but i may not use

Dim formParent1 as formParent = new formParent()

how can I access this propery, I am new at VB.net
best regards

  • 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-10T11:49:19+00:00Added an answer on June 10, 2026 at 11:49 am

    If I understand you correctly, that code is inside a child form of formParent. To use a reference to the current formParent you need to pass inside the child form a reference to this current formParent.

    So in the formParent, when you start the execution of the child form, write this:

    Dim f as formChild = new formChild(Me)
    f.ShowDialog() 
    

    in the form child constructor save the passed reference to the global variable formParent1

    Dim formParent1 as formParent ' this is the global level reference to the parentForm'
    
    Public Sub formChild(ByVal f as formParent)
           formParent1 = f
    End Sub
    

    now you can use the reference formParent1 inside the child form without initialize another formParent
    For example, assuming that the formParent1 contains a public property named SearchResult, when you complete your search you call:

    Private Sub searchBtn_Click(sender As Object, e As System.EventArgs) Handles SearchButton.Click
         Dim searchResult as String
    
         ' Here write the code that executes the search and set the value in searchResult variable
    
         ' Pass the searchResult variable to the parent form via the global reference.
         formParent1.SearchResult = searchResult
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to access a integer and a string from a class to all
I want to access all the files in a folder to add to a
Currently since I want to access user information in all my templates, I always
HI all, Iam using VS2008 and SQL2008 i want to access my stored procedures
I have two Entities University courses Course students i want to access all the
I have ArrayList>. In another activity I want to access all values stored in
Case A (function(){ //this is to access this a property PublicItem from outside this
This whole Facebook access_token thing is driving me nuts. All I want to do
All I want to do is return the index of the i that is
All I want to do is write hello world to a QGraphicsScene in a

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.