Results 1 to 15 of 15

Thread: Usercontrol not updating when placed on TabControl pages

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Usercontrol not updating when placed on TabControl pages

    Hi

    Could someone shed some light on this please

    VS2008 VB.NET

    I have a usercontrol which has a number of labels on it. The usercontrol acts a bit like a listbox but I can control the background and foreground color of the labels it contains - nothing fancy use it for logging a process - a bit like a scrolling console window.

    I have a form with 3 of these controls, Progress, Errors, and a debug logger. Works fine when placed on a form

    ...until I add a tab control with three paces and place each usercontrol on a tabpage. then random labels are not updated.

    Move the UC off the tab control - fine
    Move them on - random updates

    What am I missing

    Help please

    Cheers
    Last edited by Enveetee; Dec 2nd, 2011 at 06:21 AM.

  2. #2
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Usercontrol not updating when placed on TabControl pages

    My best guess would be that the error is in your control and that It has something to do with the parent of the control.

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Re: Usercontrol not updating when placed on TabControl pages

    The data is being added to my control, and I can raise an event which is received by the calling app, it's just the labels in the control are not updated...

  4. #4
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Usercontrol not updating when placed on TabControl pages

    You would have to look at the code of your usercontrol and you will probably find the problem there. without seeing the actual code all we can do is guess.

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Usercontrol not updating when placed on TabControl pages

    what happens when you place multiple usercontrols on the form? I bet the same thing would happen... sounds like your usercontrol might have instance issues.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  6. #6
    PowerPoster i00's Avatar
    Join Date
    Mar 2002
    Location
    1/2 way accross the galaxy.. and then some
    Posts
    2,390

    Re: Usercontrol not updating when placed on TabControl pages

    Why don't you owner draw a listbox?

    Kris

  7. #7

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Re: Usercontrol not updating when placed on TabControl pages

    Quote Originally Posted by techgnome View Post
    what happens when you place multiple usercontrols on the form? I bet the same thing would happen... sounds like your usercontrol might have instance issues.

    -tg
    Multiple instances on the form work fine, the control only has issues when it's on the tabcontrol

  8. #8

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Re: Usercontrol not updating when placed on TabControl pages

    Quote Originally Posted by i00 View Post
    Why don't you owner draw a listbox?

    Kris
    Kris

    AFAIK you cannot change the background (or even foreground) colors on a listbox - Is this correct?

  9. #9
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Usercontrol not updating when placed on TabControl pages

    Quote Originally Posted by Enveetee View Post
    Kris

    AFAIK you cannot change the background (or even foreground) colors on a listbox - Is this correct?
    Actually you can change both.

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  10. #10
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Usercontrol not updating when placed on TabControl pages

    Quote Originally Posted by Enveetee View Post
    Multiple instances on the form work fine, the control only has issues when it's on the tabcontrol
    That has got nothing to do with inheritance

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  11. #11

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Re: Usercontrol not updating when placed on TabControl pages

    Quote Originally Posted by BlindSniper View Post
    Actually you can change both.
    Do you have an example pls

  12. #12
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Usercontrol not updating when placed on TabControl pages

    do a search for "owner drawn listbox vb" .... should turn up a few results...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  13. #13

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Re: Usercontrol not updating when placed on TabControl pages

    Quote Originally Posted by techgnome View Post
    do a search for "owner drawn listbox vb" .... should turn up a few results...

    -tg
    Thanks for the tip but I can't find a way of changing the background color of each items. Foreground does not seem to be an issued, even multiple colors on a single line (iitem) but can't change the item's background color

  14. #14
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Usercontrol not updating when placed on TabControl pages

    You asked if it is possible to change the background color of a listbox and yes you can, but you cannot change the background of an individual item. You should be more clear when you post. As for your usercontrol problem you will probably have to post the code to have any hope of someone successfully helping you.

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

  15. #15

    Thread Starter
    Member
    Join Date
    Nov 2009
    Posts
    62

    Re: Usercontrol not updating when placed on TabControl pages

    Quote Originally Posted by BlindSniper View Post
    You asked if it is possible to change the background color of a listbox and yes you can, but you cannot change the background of an individual item. You should be more clear when you post. As for your usercontrol problem you will probably have to post the code to have any hope of someone successfully helping you.
    Yeah, you're right, sorry group

    I'm currently stripping the control down to the point where I can recreate the problem with the minimum of code, I'll post it once done

    Again, apologies

    Cheers

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