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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:50:09+00:00 2026-05-11T15:50:09+00:00

I have a Parent Form that holds a HUD with First Name, Last Name,

  • 0

I have a Parent Form that holds a ‘HUD’ with First Name, Last Name, etc. One of the child forms is a Search Form. When the user selects a member from the results that are displayed in a DataGrid I want the pertinent information to fill in the HUD. I created a HUD class with variables for each value and a method called UpdateHUD(). I am unsure how to get this working. I have a reference to the Search Form of the Parent form containing the HUD, like so:

public frmWWCModuleHost _frmWWCModuleHost; 

This is the code I use to embed forms. I am not using MDI.

 public static void ShowFormInContainerControl(Control ctl, Form frm)     {         frm.TopLevel = false;         frm.FormBorderStyle = FormBorderStyle.None;         frm.Dock = DockStyle.Fill;         frm.Visible = true;         ctl.Controls.Add(frm);     } 

Here is the code I am running on Cell Click on the Search Form. This is from before I tried implementing the HUD class.

private void dgvSearchResults_CellContentClick(object sender, DataGridViewCellEventArgs e)     {         _frmWWCModuleHost = new frmWWCModuleHost();         _frmWWCModuleHost.tbxHUD_LastName.Text = dgvSearchResults.CurrentRow.Cells[1].FormattedValue.ToString();         _frmWWCModuleHost.tbxHUD_LastName.Invalidate();         _frmWWCModuleHost.FormPaint();     } 

Thanks in advance!

~ Patrick


EDIT


dgvSearchResults_CellContentClick is now current. When I step through this code it is getting the correct Value here but it is never updating the actual HUD.


EDIT 2


Is my problem that I am declaring a NEW frmWWCModuleHost instead of passing a ref to the existing? I am still pretty weak in my understanding of this.


EDIT 3


I have ‘solved’ this by doing the following: On the Parent Form where I declare the Child Form I pass this as a param. Then in the constructor of the child form I added _frmWWCModuleHost = m_parent; I have a UpdateHUD() method on my Parent form and I call it from the _CellClick event on the child.

Now to rephrase my question; Is there anything glaringly wrong with doing it this way?

  • 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. 2026-05-11T15:50:10+00:00Added an answer on May 11, 2026 at 3:50 pm

    When the child form search completes, raise a ‘SearchCompleted’ event. Then anything (including the parent form) can subscribe to that event and retrieve the details.

    See the following NotepadCode for an example:

    class ParentForm {     private readonly ChildForm childForm;      public ParentForm()     {         InitializeComponent();          childForm = new ChildForm();          childForm.SearchCompleted += childForm_SearchCompleted;     }      private void childForm_SearchCompleted(object sender, SearchCompletedEventArgs e)     {         // Update the display         lblName.Text = e.DataToDisplay;     } }  class ChildForm {     public event EventHandler<SearchCompletedEventArgs> SearchCompleted;      private void Search(string query)     {         // Do the searching          OnSearchCompleted(new SearchCompletedEventArgs([arg values]));     }      public void OnSearchCompleted(SearchCompletedEventArgs args)     {         if (SearchCompleted != null)         {             SearchCompleted(this, args);         }     } } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The problem is that i have two forms. First is parent form, second is
In my windows forms project I have a parent form that is creates other
I have a Windows Form application that involves two Forms. The child form is
I have a form that acts as MDI parent form and several other forms
I have a child form that I load from a parent form. The parent
I have a parent form that is set to be TopMost and then I
I have an MDI parent form that creates many MDI children at run time.
I have a parent form and a child form. I need to open the
I have a nested form Parent, which accepts attribute for Child. In my controller#new,
I have a parent form that contains a lot of controls. What I am

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.