Error in Setting Text to NULL

3 posts, 0 answers
  1. Saif
    Saif  avatar
    30 posts
    Member since:
    Apr 2014

    Posted 24 May 2014 Link to this post

    Please tell me what is wrong with my code?
    Every time i set the .Text to null it gives error "Object reference not set to an instance of an object."

    public Form1()
        {
          InitializeComponent();

          DataTable dt = new DataTable();
          dt.Columns.Add("TEST");
          for (int i = 0; i < 5; i++)
          {
            dt.Rows.Add(Guid.NewGuid());
          }
          this.radMultiColumnComboBox1.DataSource = dt;

          this.radMultiColumnComboBox1.Text = null;
        }

        private void radButton1_Click(object sender, EventArgs e)
        {
          this.radMultiColumnComboBox1.Text = null;
        }
  2. Saif
    Saif  avatar
    30 posts
    Member since:
    Apr 2014

    Posted 24 May 2014 Link to this post

    Problem solved.
    Thanks for the ResetText method and its working fine.
    And i still dont know why in .Text = null is error
    Sorry for double posting
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 26 May 2014 Link to this post

    Hello Saif,

    Thank you for writing.

    The reason for the observed exception is that we are using the properties of the Text property to handle the text selection in the control. I will log this case and we will handle it in a future release. Here is a link to the item: http://feedback.telerik.com/Project/154/Feedback/Details/129142.

    I have updated your Telerik Points for this report.

    For the time being, you should use the method you found, or just set the Text to string.Empty (this is what the method does internally as well), instead of using null.

    I hope that you find this information useful.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top