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

  • Home
  • SEARCH
  • 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 7075227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:09:08+00:00 2026-05-28T06:09:08+00:00

Trying to bind a String to a RichTextBox.Text property so that when the String

  • 0

Trying to bind a String to a RichTextBox.Text property so that when the String value changes, that change is reflected in the RichTextBox. So far I’m unsuccessful.

string test = "Test";
rtxt_chatLog.DataBindings.Add("Text",test,null);
test = "a";

This shows “Test” in the rtxt_chatLog, but not the “a”.

Even tried adding rtxt_chatLog.Refresh(); but that does not make any difference.

Update 1:
This does not work either:

public class Test
{
    public string Property { get; set; }
}

Test t = new Test();
t.Property = "test";
rtxt_chatLog.DataBindings.Add("Text", t, "Property");
t.Property = "a";

Am I not understanding data binding correctly?

  • 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. Editorial Team
    Editorial Team
    2026-05-28T06:09:08+00:00Added an answer on May 28, 2026 at 6:09 am

    The String class doesn’t implement INotifyPropertyChanged, so there are no events for the binding source to tell the RichTextBox that something changed.

    Try updating your class with the INotifyPropertyChanged implemented:

    public class Test : INotifyPropertyChanged {
      public event PropertyChangedEventHandler PropertyChanged;
    
      private string _PropertyText = string.Empty;
    
      public string PropertyText {
        get { return _PropertyText; }
        set {
          _PropertyText = value;
          OnPropertyChanged("PropertyText");
        }
      }
    
      private void OnPropertyChanged(string propertyName) {
        if (PropertyChanged != null)
          PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
    

    }

    Also, it looks like DataBinding doesn’t like the name “Property” for a property name. Try changing it to something else other than “Property”.

    rtxt_chatLog.DataBindings.Add("Text", t, "PropertyText");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ActionMethod and I'm trying to bind a string from a value
I'm trying to bind a data value to an attached property. However, it just
I am trying to bind the Text of a TextBox named 'txtImage' to an
I'm trying to bind a XAML ComboBox so that its list items are the
I am trying to bind some diagrams to a dictionary of string, int, and
I'm trying to bind a ListBox's SelectedItem data to a property. The following code
I'm trying to bind a second level property of my class to a combobox.
I am trying to bind a JTextField to a bean's field that is a
I am trying to bind a property (Button.Background) to a property on my custom
I am trying to bind an ASP.NET GridView control to an string array and

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.