i seem to get stuck a lot but... I want to have a method displayData() that when called will change richtTextBox.Text to a string value I have. But I don't know how to access the richt text box from within my method. I tried changing it to public using its properties but that didn't work . And Form3.richTextBox doesn't work either. I have a feeling this isn't actually possible, so if not what should I do to work around this problem?
pwolf
14
Junior Poster in Training
Recommended Answers
Jump to PostIt is possible. You must first create an instance of the form you are trying to access, and then call the object in the form:
Form3 form3 = new Form3() form3.richTextBoxInstance.Text = "new Text"; //richTextBoxInstance should be the name of the object
Remember you must call …
Jump to PostI suspect you have something else going on at that time. We'll need the code in the form your accessing the RichTextBox, and the code for the form that contains the RichTextBox.
Jump to Posti think you have to make getter and setter functions for specific textbox and then use them to get and set values . i think there is a property of modifier , it is private bydefault change it to public try it.
All 11 Replies
ndeniche
402
Posting Virtuoso
Featured Poster
pwolf
14
Junior Poster in Training
tinstaafl
1,176
Posting Maven
pwolf
14
Junior Poster in Training
M.Waqas Aslam
67
Posting Pro in Training
Featured Poster
tinstaafl
1,176
Posting Maven
kouroshnik
0
Light Poster
pwolf
14
Junior Poster in Training
tinstaafl
1,176
Posting Maven
pwolf
14
Junior Poster in Training
tinstaafl
1,176
Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.