Click here to Skip to main content
15,889,808 members
Home / Discussions / C#
   

C#

 
GeneralRe: Stackoverflow Pin
OriginalGriff23-Sep-18 6:27
mveOriginalGriff23-Sep-18 6:27 
QuestionC# Post files through rest api error Pin
Pradeep Kumar21-Sep-18 13:07
Pradeep Kumar21-Sep-18 13:07 
AnswerRe: C# Post files through rest api error Pin
Richard MacCutchan21-Sep-18 21:37
mveRichard MacCutchan21-Sep-18 21:37 
Questionstore image in DB by Parameters.AddWithValue Pin
Member 1352250120-Sep-18 17:01
Member 1352250120-Sep-18 17:01 
AnswerRe: store image in DB by Parameters.AddWithValue Pin
OriginalGriff20-Sep-18 21:23
mveOriginalGriff20-Sep-18 21:23 
QuestionHow to modify picturebox image when clicked button Pin
mores.JR20-Sep-18 9:54
mores.JR20-Sep-18 9:54 
QuestionMessage Removed Pin
20-Sep-18 9:07
Member 1399203720-Sep-18 9:07 
Questioncommunication between two child forms in C# Pin
Member 1332584619-Sep-18 13:10
Member 1332584619-Sep-18 13:10 
I want to perform some communication between two child forms that are each opened from a parent form (separate button to show each form). I want to change the visibility and value of a numericalUpDown and also the visibility and text of a textbox.

I have used properties, the get part is working perfectly, but the set part works only on the child.show() event, e.g. when I click on Child1Form.button to show the Child2Form the "set" part works, but if I do not show Child2Form, it does not work. and i also do not want to use from setting files.

I used form event handling. The method has gotten fired and the message has shown correctly, but the changes in text and visibility have not.

On the parents side where I call the publisher form, means Child3 form:

C#
Child3 child3 = new Child3();
Child1 child1 = new Child1();
child3.Child1Button2Clicked += child1.child3_Child1Button2Clicked;
child3.Show();


On the subscriber(listener) side:
Event Handling between two child forms that each open from the same parent (Two child - one parent).

C#
public void child3_Child1Button2Clicked(object sender, FormsCommunication e)
{
    NumericalUD1.Visible = e.NumericalUDPass;
    textBox1.Text = e.textBoxPass;
    MessageBox.Show("it got fire" + ": " + e.NumericalUDPass.ToString() + ": " + e.textBoxPass.ToString());
 }


On the publisher side:

C#
public event EventHandler<FormsCommunication> Child1Button2Clicked;


//button click event to set the values and fire the method.

C#
private void Child3Btn1_Click(object sender, EventArgs e)
{
    FormsCommunication formsCommunication = new 
    FormsCommunication("2782",Convert.ToBoolean(false));

    OnChild1Button2Clicked(formsCommunication);

}

protected virtual void OnChild1Button2Clicked(FormsCommunication e)
{
    Child1Button2Clicked?.Invoke(this, e);
}



//the constructor in the EventArgs Class:

C#
public FormsCommunication(string textBox, bool NumericalUD)
 {
    textBoxPass = textBox;
    NumericalUDPass = NumericalUD;   
 }

 public string textBoxPass { get; private set; }
 public bool NumericalUDPass { get; private set; }

AnswerRe: communication between two child forms in C# Pin
OriginalGriff19-Sep-18 19:56
mveOriginalGriff19-Sep-18 19:56 
GeneralRe: communication between two child forms in C# Pin
Member 1332584621-Sep-18 9:07
Member 1332584621-Sep-18 9:07 
GeneralRe: communication between two child forms in C# Pin
OriginalGriff21-Sep-18 23:57
mveOriginalGriff21-Sep-18 23:57 
GeneralRe: communication between two child forms in C# Pin
Member 1332584622-Sep-18 10:44
Member 1332584622-Sep-18 10:44 
GeneralRe: communication between two child forms in C# Pin
OriginalGriff22-Sep-18 21:07
mveOriginalGriff22-Sep-18 21:07 
GeneralRe: communication between two child forms in C# Pin
Member 1332584623-Sep-18 7:26
Member 1332584623-Sep-18 7:26 
GeneralRe: communication between two child forms in C# Pin
OriginalGriff23-Sep-18 7:36
mveOriginalGriff23-Sep-18 7:36 
GeneralRe: communication between two child forms in C# Pin
Member 1332584625-Sep-18 10:13
Member 1332584625-Sep-18 10:13 
Questionhow to make a gird of pictureboxs with c# Pin
mores.JR19-Sep-18 7:15
mores.JR19-Sep-18 7:15 
AnswerRe: how to make a gird of pictureboxs with c# Pin
OriginalGriff19-Sep-18 8:05
mveOriginalGriff19-Sep-18 8:05 
GeneralRe: how to make a gird of pictureboxs with c# Pin
mores.JR20-Sep-18 9:55
mores.JR20-Sep-18 9:55 
QuestionImage processing Pin
Member 266560619-Sep-18 3:39
Member 266560619-Sep-18 3:39 
AnswerRe: Image processing Pin
OriginalGriff19-Sep-18 4:18
mveOriginalGriff19-Sep-18 4:18 
AnswerRe: Image processing Pin
Pete O'Hanlon19-Sep-18 5:05
mvePete O'Hanlon19-Sep-18 5:05 
QuestionApplications settings get messed up Pin
Acuena18-Sep-18 3:32
Acuena18-Sep-18 3:32 
QuestionC# Beginner - Online Student Project Pin
Member 1398787017-Sep-18 13:14
Member 1398787017-Sep-18 13:14 
AnswerRe: C# Beginner - Online Student Project Pin
Mycroft Holmes17-Sep-18 14:17
professionalMycroft Holmes17-Sep-18 14:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.