Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 4th, 2003, 05:23 AM
roy_uk roy_uk is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 1 roy_uk User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Possibly Unkown Combo Box Bug in VB6

Hi,

Im sure this bug has been found by other developers, but I still havent found a solution. A brief synopsis of the circumstances causing the error follows:

1. Populate a Combobox (for the sake of a test keep it between 15 and 30). This can be done on the form load event
2. Drop the list to display the items. This list must remain displayed from here on. When you drop the list, enable a timer perform step 3:
3. Remove Items from the list one by one over a given period of time using a timer (around 10 seconds for example) until the list count is zero.

The result is a paint problem where the last few items of the list still remain visible on the screen as the Combo Box does not repaint the area where the list is.

Obvious solutions would be to repaint or refresh the screen, but im not sure of what API calls do this. Ive also tried automatically moving the form (Form.Move()) off the screen and back to its original position in an instant. This works, but is a messy solution as it does not repaint the screen where the list has exceeded the height of the form.

For the sake of my application that I am developing, it is required that I must have the ComboBox list displayed whilst removing items, so I have to solve this one.

Any fixes or solutions would be helpful.

Many Thanks

Roy


Sample code requiring a timer and a combobox can be run below. All you have to do is drop the list to start the test:


'Combo Box Paint Bug.
'VB6, Service Pack 5, Windows 2000
'Run and drop the list to start the test. Wait until

Private Sub Form_Load()
Dim iIndex As Integer

'Set some form dimensions to make sure the list exceeds the height of the form
Me.Height = 1000
Me.Width = 3000
Me.Caption = "Drop the Combo Box"

With Combo1
'Tidy up the position of the ComboBox
.Top = 30
.Left = 30
.Width = 2000

'Add some of the letters of the alphabet
For iIndex = 64 To 78
.AddItem Chr(iIndex)
Next iIndex
End With
End Sub


Private Sub Combo1_Change()
'Enable the timer to start removing items upon displaying the list
Timer1.Enabled = True
Me.Caption = "Test Started"
End Sub


Private Sub Timer1_Timer()
Dim iIndex As Integer


If Combo1.ListCount = 0 Then
'If there are no items left in the list, disable the timer.
Timer1.Enabled = False
Me.Caption = "Test Completed"
Exit Sub
End If

Combo1.RemoveItem 0
End Sub

Reply With Quote
  #2  
Old September 4th, 2003, 06:54 AM
zak2zak zak2zak is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Singapore
Posts: 34 zak2zak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via Yahoo to zak2zak
Lightbulb May I Comment....

May be this helps...
Why don't U use .Refresh Method?
Code:
Private Sub Timer1_Timer() 
Dim iIndex As Integer 

If Combo1.ListCount = 0 Then 
'If there are no items left in the list, disable the timer. 
Timer1.Enabled = False 
Me.Caption = "Test Completed" 
Exit Sub 
End If 

Combo1.RemoveItem 0
Combo1.Refresh 
End Sub
__________________
I May Have Misinterpret U'r Post
Correct Me If I Am Wrong......//
Enjoy Coding..........................///

zak2zak

Reply With Quote
  #3  
Old September 10th, 2003, 09:57 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
No! zak2zak! It's Not useful!
Maybe is a big bug about ComBoBox.

Reply With Quote
  #4  
Old September 10th, 2003, 01:28 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,982 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 1 Day 18 h 42 m 27 sec
Reputation Power: 814
I get similar results on XP Pro SP1 and VB6 SP5. It looks like a bug to me too

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Possibly Unkown Combo Box Bug in VB6


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT