Results 1 to 5 of 5

Thread: Inherited User control - listview

  1. #1

    Thread Starter
    Lively Member tom_hotspur's Avatar
    Join Date
    Aug 2002
    Location
    Stafford
    Posts
    96

    Inherited User control - listview

    Hiya

    Basically what i'm planning to do is create a 'custom' listview control that behaves like a very basic grid.

    I.e. i can specify a cell reference (row, col) with something like

    VB Code:
    1. me.listgridview.CellValue(1, 2) = strValue

    OR i can specify the font of the cell etc...

    Basically this is just manipulation of the listitems and subitems. At the moment i am just using a listview within my project and manipulate the list/subitems as i go along, so i've got the basic code.

    Problem is i haven't a clue about how to setup a user control in vb.net

    Is this a "inherited user control" or just a "user control"? the terminology has confused me a bit!

    could anyone give me some advice about how to set up a "inherited user control" or a "user control"

    cheers
    tom

  2. #2
    New Member
    Join Date
    Feb 2003
    Location
    Maputo, Moçambique
    Posts
    13
    Hi!

    A "user control" inherits from System.Windows.Forms.UserControl. You create them with Add->Add User Control. This will give you a surface similar to a form where you can add controls from the toolbox, just like you do on a form. After the project is built, the control should appear in the toolbox and you can use it in your forms.

    A "inherited user contol" works in the same way, but is inherited from a user control that already exists (created by you).

    Then there is also something called "custom control" that inherits directly from a control. A custom textbox would inherit from System.Windows.Forms.TextBox. This is useful when you for example want to create a textbox that only accepts integers as input. A custom control is created with Add->Add New Item, and then you select "Custom Control". After the control is created you use "Customize toolbox" to make it visible in the toolbox.

    So if you want to create a control that contains various labels, textboxes etc you use "user control". If you want to create a control that is a textbox or a label etc you use a "custom control".

    I've never used the listview control, so I don't know what it does and what you want it to do. But it seems like what you want is a custom control.

    The terms "user control" and "custom control" are often mixed and you end up very confused when searching for information about this. User control is also sometimes called "Composite control"

    /Sara

  3. #3

    Thread Starter
    Lively Member tom_hotspur's Avatar
    Join Date
    Aug 2002
    Location
    Stafford
    Posts
    96
    Thanks for the help Sara.

    Much appreciated.
    tom

  4. #4
    Fanatic Member
    Join Date
    Jun 1999
    Location
    California, USA
    Posts
    662

    Re: Inherited User control - listview

    Quote Originally Posted by SaraL
    Hi!

    A "user control" inherits from System.Windows.Forms.UserControl. You create them with Add->Add User Control. This will give you a surface similar to a form where you can add controls from the toolbox, just like you do on a form. After the project is built, the control should appear in the toolbox and you can use it in your forms.

    A "inherited user contol" works in the same way, but is inherited from a user control that already exists (created by you).

    Then there is also something called "custom control" that inherits directly from a control. A custom textbox would inherit from System.Windows.Forms.TextBox. This is useful when you for example want to create a textbox that only accepts integers as input. A custom control is created with Add->Add New Item, and then you select "Custom Control". After the control is created you use "Customize toolbox" to make it visible in the toolbox.

    So if you want to create a control that contains various labels, textboxes etc you use "user control". If you want to create a control that is a textbox or a label etc you use a "custom control".

    I've never used the listview control, so I don't know what it does and what you want it to do. But it seems like what you want is a custom control.

    The terms "user control" and "custom control" are often mixed and you end up very confused when searching for information about this. User control is also sometimes called "Composite control"

    /Sara
    Where is this 'customize toolbox' option again? I'm not seeing it anywhere in the .net 2003 ide

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Inherited User control - listview

    Add/Remove Items...

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