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

    Don't know enough about C# yet to know how to search for my question....

    Hello all,

    I am just starting out using VS2012 Pro & .NET 4.5 coming from an Eclipse/Java background. I am in the process of porting a Java program to .NET.

    After reading on MSDN about RichTextBoxes, I've decided to go that route for displaying my syntax colored text. In the MSDN example, it shows the need to have "using System.Windows.Documents;" declared.

    The problem I am having is that Documents is not one of the choices presented by the IntelliSense system. I only have Forms, Input, and Markup available as descendants of System.Windows.

    I just started using VS this morning, so everything is still Greek to me.

    Right clicking on my project in Solution Explorer and choosing Properties, the Target Framework is listed as .NET 4.5 and the Output Type is shown as Windows Application.

    Any info you can provide on how to enable System.Windows.Documents would be greatly appreciated.

    Cheers

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Don't know enough about C# yet to know how to search for my question....

    You need to add a reference to the .net assembly that contains the System.Windows.Documents namespace.

    Do do this, select the project in the solution explorer. Right click on the References node and choose "add reference". In the .net tab, add the appropriate reference.

  3. #3
    Join Date
    Feb 2013
    Posts
    3

    Re: Don't know enough about C# yet to know how to search for my question....

    I appreciate the response. I followed your instructions and was surprised to see that I don't have a tab labeled .NET, though I am targeting Framework 4.5.

    I scrolled down the list and found System.Windows, but Documents was not there. Using the search feature did not reveal it either.

    Do I need to reinstall .NET perhaps? If so, should I uninstall it first or just write over the current installation?

    I've included a screen shot of the dialog box.

    Cheers
    Name:  Capture.JPG
Views: 778
Size:  73.1 KB

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Don't know enough about C# yet to know how to search for my question....

    I missed that you were using VS2012 (even though you clearly listed it). At any rate, you are in the correct area to add the reference to the assembly.

    Not sure what msdn article you are referring to, but perhaps the namespace it lists is wrong?

    The namespace and assembly you need is decided based on whether your app is a winforms app, wpf or Silverlight app.

    Search bing or google for "RichTextBox winforms msdn", "RichTextBox wpf msdn", or "RichTextBox Silverlight msdn".

    In the search results, look for the "RichTextBox Class" entry (usually gets returned at the top).

    The msdn entry will specify the namespace and assembly name.

    Keep in mind that you need to match these entries with the type of app you have (winforms, wpf, etc.).

  5. #5
    Join Date
    Feb 2013
    Posts
    3

    Re: Don't know enough about C# yet to know how to search for my question....

    Thank you for the follow up. My .NET learning has ground to a stop these past two weeks. That combined with a new job opportunity using Java may stop my .NET work altogether here shortly.

    I will try your instructions out soon.

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