Thanks for the reply! I have attached a zip with a sample project which (I think) illustrates my problem. If you have some time to spare, could you take a look at it? Thanks and sorry for my pretty rookie problems... http://www.djnokturnal.com/downloads/TextBoxes.zip[^]
DJNokturnal
Posts
-
Control access from other classes -
Control access from other classesI was interested in how to accomplish this: Say I have a textbox on form1.cs. I would like to print messages into that textbox from other class files such as work.cs I am sure this is very simple and I am an idiot hehehehe Can someone help me out?
-
Communication with controls between classes..\..\..\SecondClass.cs(12): 'System.Windows.Forms.Form' does not contain a definition for 'textFromSecondClass' That is what I get when I try to use your code. I guess I have some reading to do. Thanks anyway.
-
Communication with controls between classesHey thanks for the reply! ... and here is the but hehehe ... Can you treat me like a moron, and show me the rewritten methods for each class? I just can't wrap my mind around this... :((
-
Communication with controls between classesHey guys... first I just want to praise The Code Project and everyone on here for basically teaching me the basics of C#. I have a web background and this is the first language I have learned coming off my javascript and vbscript web knowledge. I am sure this question has a very simple answer, but that is an answer I cannot figure out! :) Here it is... I have dummied down my problem into the following code examples. I have a very basic program that takes one richtext field and copies the content into another. I am doing so by calling a method in a separate class that accomplishes the copying of text. Form1.cs:
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace TestApp { /// /// Summary description for Form1. /// public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; public System.Windows.Forms.RichTextBox txtFromSecondClass; public System.Windows.Forms.RichTextBox txtToSecondClass; private System.Windows.Forms.Label label2; private System.Windows.Forms.Button button1; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public Form1() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.txtFromSecondClass = new System.Windows.Forms.RichTextBox(); this.label1 = new System.Windows.Forms.Label(); this.txtToSecondClass = new System.Windows.Forms.RichTextBox(); this.label2 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // txtFromSecondClass // this.txtFromSecondClass.Location = new System.Drawing.Point(8, 200); this.txtFromSecondClass.Name = "txtFromSecondClass"; this.t