Hi Ali, You shouldn't override the OnPaint event because that gets fired a
lot, depending on the drawing state of the control.
--
Remember: There's no place like 127.0.0.1
==============================================
Happy To Help,
Tom Spink
http://dotnetx.betasafe.com >> VB, VB.NET, C#, C++ Code
Happy Coding!!
Please respond to the newsgroups, so all can benefit.
One day
Quote:
> Let me restate the problem:
> I can use OnCreateHandle but why OnPaint cannot be overriden? I mean I
> override it but it is never fired!!
> Thanks
> Ali
> > Hi All,
> > That is pretty strange for me that I this time I could not find my
answer
> in
> > any newsletter or forum or anywhere on the net. Here is the problem:
> > I would like to do a very simple task; inherit from a combobox and load
a
> > list of operators from a table on a SQL database when form loads.
> > I put loading code in constructor:
> > Public Class DclUsersCombo
> > Inherits ComboBox
> > Public Sub New()
> > MyBase.New()
> > Me.DataSource = DclSecurity.GetDclOperatorList() ' returns an
> > arraylist of operators
> > End Sub
> > But the problem was that when I added the control to a form, VS.NET
behind
> > the scene reads from the database and on InitializeComponent, adds list
of
> > operators as an arraylist, so I will have the list but reading offline
> from
> > persisted arraylist:
> > Me.DclUsersCombo1.DataSource =
> > CType(resources.GetObject("DclUsersCombo1.DataSource"),
> > System.Collections.ArrayList)
> > Me.DclUsersCombo1.Items.AddRange(New Object() {"Ali Kheyrollahi",
> "John
> > Doe", ..., "Someone Whoever" })
> > I was also unable to find a suitable "loading" event for control. Also
> > checking if control is at design-time did not help.
> > What should I do?
> > Many Thanks in advance
> > Ali Kheyrollahi