WebSep 22, 2009 · Hi I have 2 forms, form1 and form2. i have some label controls in the form1 and their Visible property are set to FALSE. now i want to change their Visible property and Text property from form2. i created a method in form2 that calls another method in the form1 and send it strings for the Text ... · Hi Write a new Constructor and define a … WebApr 19, 2024 · 1 solution Solution 1 There are several ways to do it, the simplest is to make the controls on your forms Public instead of Private in the Designer, but this is considered bad practice. You can find another solution here: How to change text in a textbox on another form in Visual C#? - Stack Overflow [ ^ ] Posted 19-Apr-19 3:41am RickZeeland
How to set Text on the Label in C#? - GeeksforGeeks
WebDec 26, 2010 · I want to update label of Form1 from Form2. So here's what I have: // Form1 public string Label1 { get { return this.label1.Text; } set { this.label1.Text = value; } } // Form2 private void button1_Click(object sender, EventArgs e) { Form1 frm1 = new Form1(); frm1.Label1 = this.textBox1.Text; this.Close(); } WebSep 27, 2012 · You need to cast fc to the actual form type before trying to access its elements: Form1 fc = (Form1)Application.OpenForms ["form1"]; if (fc != null) { fc.lblNewItems.Text = "Change text"; } Share Improve this answer Follow answered Sep 27, 2012 at 16:20 verdesmarald 11.6k 2 44 60 Add a comment 1 rmseas
Changing a label
WebNov 12, 2024 · Using either of these two options, you should have a method in Form1 that Form2 can call and pass the new text as an argument. Form1 would then update its own Label in that method. The third option feels the most complex if you're not used to doing things the proper way but it is the proper way. WebSep 26, 2024 · 1 solution Solution 1 oh i need set the labeltext first before showdialog.. private void btnLaporan_Click ( object sender, EventArgs e) { laporan lprn = new laporan (); lprn.lblorang.Text = "User"; lprn.ShowDialog (); this .Hide (); } Posted 26-Sep-18 17:22pm Muhammad nur Ihsan Add your solution here I have read and agree to the and WebOct 4, 2024 · Change the Modifier e.g. in the property window for the control. Change it from Private to Public. Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. rmsea and cfi