locked
What is the purpose of the line Imports System.ComponenetModel? RRS feed

  • Question

  •  

    I'm trying to create inherited user control (not sure whether this is the right term).  I have created a class Button (button.vb - there is no button.designer.vb) in a project with the following coding:

     

    Public Class Button

    Inherits System.Windows.Forms.Button

    End Class

     

    After I build the project, I have no problem adding it to the toolbar and using it in another solution.

     

    When I look at other user controls, I see there is a line Imports System.ComponentModel.  I want to know what is the effect of adding that line to my coding:

     

    Imports System.ComponentModel

     

    Public Class Button

    Inherits System.Windows.Forms.Button

    End Class

    Wednesday, February 27, 2008 12:17 AM

Answers

  • An Imports directive just lets you use types from that namespace without fully qualifying the name.  For example you can write just BindingList instead of System.ComponentModel.BindingList.

     

    Imports directives don't change the compiled code in any way.

     

     

    Wednesday, February 27, 2008 10:59 AM