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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:23:22+00:00 2026-05-26T11:23:22+00:00

I am having a form in which I can input data from one window

  • 0

I am having a form in which I can input data from one window and then press enter button (btnEnter) and click display (btnShowBooks) button and show data in other window. When I press btnEnter with code below and then click btnShowBooks to display input in new window the txtBookList textbox is still empty. Here is a simplified code which doesn’t work and hope for some tips.

BookEntry form file

private void btnEnter_Click(object sender, EventArgs e)
{
    BookList bookList = new BookList();
    bookList.txtBookList.Text = "aaa";
}

BookList form file in which I have the layout and close button so there isn’t any relevant code. There is only texbox named txtBookList and btnClose button.

In BookList designer file I have made the field public:

public System.Windows.Forms.TextBox txtBookList;

Regards. HelpNeeder.

— SOLVED —

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;

namespace Lab_8
{
    public partial class BookEntry : Form
    {
        BookList bookList = new BookList();

        public BookEntry()
        {
            InitializeComponent();
        }

        private void btnEnter_Click(object sender, EventArgs e)
        {
            bookList.txtBookList.Text = "aaa";
        }

        private void btnShowBooks_Click(object sender, EventArgs e)
        {
            bookList.ShowDialog();
        }
    }
}
  • 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-05-26T11:23:23+00:00Added an answer on May 26, 2026 at 11:23 am

    I just replicated this and it is working fine (VS2010 .NET4).. are you showing the same instance of the form afterwards? (as below):

    BookList bookList = new BookList();
    bookList.txtBookList.Text = "aaa";
    bookList.Show();
    

    EDIT

    Given your response, it seems that you’re instantiating separate forms. Here is what you need to do:

    First, in your main form, declare this:

    private BookList _bookList = new BookList();
    

    Then, wherever you need to reference that form, use _bookList to accomplish that. E.g:

    _bookList.txtBookList.Text = "aaa";
    _bookList.ShowDialog();
    

    You need to keep 1 reference to the dialog whenever you’re performing tasks. If you do this each time you want to operate on that form:

    BookList bookList = new BookList();
    

    You are actually creating completely different copies of the form.

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

Sidebar

Related Questions

I'm just wondering which one is better, or more recommended for processing form data.
i am using a Form where i am having a textbox which on submit
i am having an form for uploading an excel file like <form enctype=multipart/form-data action=http://localhost/joomla/Joomla_1.5.7/index.php?option=com_jumi&fileid=7
I am having trouble grabbing the values from the form once processed. I need
I'm trying to create a consent form, and having the user input their name.
How would one go about having a multi step type form with zend. This
I have a model tube which is a database having the various data for
I have a search form on which I have the following INPUT field <input
I am having some issues creating the code which should show a button only
I am having an issue when processing form data. When the form is submitted,

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.