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

  • Home
  • SEARCH
  • 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 6628749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:09:42+00:00 2026-05-25T22:09:42+00:00

I have a form (AddNewCamper), which contains a textbox and a submit button. In

  • 0

I have a form (AddNewCamper), which contains a textbox and a submit button. In a different form, I’m trying to write:

if (submit button is clicked)
   do stuff

In the window that the button is actually in, I have a click event created. So I guess I’m trying to call that click event inside the if statement (which is in a different window from where the click event is located).

Here’s what I have:

AddNewCamper camp = new AddNewCamper();
camp.Show();

// This is where I'm confused. How do I say if this button is clicked,
// or how do i call its click event that's located in AddNewCamper?
if (camp.btnNewSubmit_Click_1())
{
    Camper person = new Camper(camp.txtNewFirstName.Text);
    camp.txtNewFirstName.Text = person.getName();
    c.testListBox.Items.Add(person.getName());
    campersFrame.Content = c;
}
  • 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-25T22:09:43+00:00Added an answer on May 25, 2026 at 10:09 pm

    As I understand your question, seems you want to display some content in the parent form when the submit button click on the AddNewCamper Form. Below is one way that you can do that.

    Add a public method to the ParentForm to Show(or refresh) the content once Submit clicked from the AddNewCamper.

    In the ParentForm

    public RefreshCamper(string firstName)
    {
        Camper person = new Camper(camp.txtNewFirstName.Text);
        camp.txtNewFirstName.Text = person.getName();
        c.testListBox.Items.Add(person.getName());
        campersFrame.Content = c;
        // ETC...
    }
    

    Pass the ParentForm instance to the AddNewCamper Form in the contructor.

    private ParentForm _parentForm;
    
    public AddNewCamper(ParentForm parentForm)
    {
        _parentForm = parentForm;
    }
    
    private void btnNewSubmit_Click_1()
    {
        _parentForm.RefreshCamper(txtNewFirstName.Text);
    }
    

    Create an AddNewCamper instance as below from the ParentForm.

     AddNewCamper camp = new AddNewCamper(this);
     camp.Show(); // Or ShowDialog if you want Model..
    

    Or you can set a flag in the ParentForm in the same way to identify that the Submit button is clicked.

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

Sidebar

Related Questions

i have form that has multiple input text boxes, Which has got some text
Let's say I have form A that contains a panel (with many other controls
I have form that is loaded into a FancyBox window. I would like to
I have form where before i was using simple post with <button name=submit id=register
I have form autocomplete code that executes when value changes in one textbox. It
I have form area in my view. If I click button A , I
I have form that displays several keywords (standard set of choice lists that changes
I have form with one input for email and two submit buttons to subscribe
I have form with 1 button. when you click on the button 3 others
I have form with few buttons and I want to know what button is

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.