CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2009
    Posts
    12

    Display LINQ results inside a RichTextBox - howto

    I have this LINQ code:
    Code:
    var ang = from employee e1 in db.employees
                                        orderby e1.hire_date descending
                                        select new { e1.fname, e1.lname, e1.hire_date };
    And I want to display the results into a RichTextBox.

    I tried richTextBoxname.toString() but obviously did not worked.

    Can anyone explain me how to display results in the richtextbox, since
    I am not very familiar with C#.

    Thank you.

  2. #2
    Join Date
    Sep 2008
    Location
    Netherlands
    Posts
    865

    Re: Display LINQ results inside a RichTextBox - howto

    you need to append the text to the richtextbox\

    Code:
    richtextbox.AppendText(""myText");
    Enumerate through your LINQ result and append each line to the richtextbox

  3. #3
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: Display LINQ results inside a RichTextBox - howto

    Code:
    foreach (var a in ang)
    {
             richTextBox1.AppendText(a.fname + "\t" + a.lname + "\t" + a.hire_date);
    }

  4. #4
    Join Date
    Feb 2009
    Posts
    12

    Re: Display LINQ results inside a RichTextBox - howto

    Thank you guys

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured