Class Library can't access System.Windows

I'm trying to create a new Class Library for a custom control. The base code is as follows:

Imports System.ComponentModel
Public Class DynamicCheckedListBox

Inherits System.w...
End Class

When I try to type System.Windows.CheckedListBox, Intellisense shows no entry for Windows.
The list displayed includes "WeakReference", "XML", but no Windows option.

In my other projects, this works fine.

Yesterday I had a similar problem wherein System.Windows was acceptable, but there was no
entry for CheckedListBox. Somehow along the way, it showed up on the list, as I tried creating
a new project.

Help! What's going on


Answer this question

Class Library can't access System.Windows

  • MarvinTPA

    Are you actually using the Express Edition and not... Visual Studio 2003 or Visual Basic Standard

  • Youssef

    Thanks for your suggestion, but... on my system, System.Windows.Forms.Listbox contains only
    ControlCollection, IntegerCollection, etc.

    Further thoughts (please)

  • MattShepherd

    Thank you for your help - it's partially successful. I can now access System.Windows.Forms,
    BUT CheckedListBox is not an option in that namespace. There is "Button", "CheckBox",
    and "ColorDialog", but no CheckedListBox.

    Any suggestions

  • Jester

    You were correct! I finally realized why the CheckedListBox didn't show up in System.Windows.Forms Its not one of the Common controls. It only shows up when I ask
    Intellisense for ALL. Duh.

    Thanks VERY much!

  • Matti Seikkula

    You will need to add a reference in your project to System.Windows.Forms.dll

    As you’ve noticed, you do not need to do this with regular WinForms apps, the reason being that the Form itself as well as all of the visual controls are contained within System.Windows.Forms.dll and in a Class Library or Console Application they are generally not needed, but if they are you have to add it yourself.

    Also, after you've added the reference you will find that System.Windows.CheckedListBox does not exist, instead, use System.Windows.Forms.CheckedListBox.



  • KennyKls

    Yes. VB 2005 EE Version 2.0.50727

  • Keyrus

    Getting close. It lives in the System.Windows.Forms.Listbox namespace. Classic case of a specialization of a listbox derived from a normal listbox.



  • Class Library can't access System.Windows