Issue related to combobox....

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2006
Posts: 1
Reputation: Gcox18 is an unknown quantity at this point 
Solved Threads: 0
Gcox18 Gcox18 is offline Offline
Newbie Poster

Re: Issue related to combobox....

 
0
  #11
Feb 23rd, 2006
Hey guys, I have a solution for this ridiculous issue. Its pretty infuriating and I have wasted a few hours now working around it. I saw a similar post and here's a way you can do it without having to inherit the combobox as posted above (although that does work):


You cannot set the text property during the selectedindexchanged event. Period. Sucks hard, but its the truth. But, you can do it by causing another event to fire on the combobox control. An easy one is the mouse move event.

....

  1. 'This moves the mouse over the combobox to cause the mousemove event to fire. Sets the text property, then puts the cursor back where it was
  2.  
  3. 'FIRST MAKE 2 PROPERTIES, ONE IS IsAlteringComboText as Boolean
  4. 'SECOND ONE IS OldMousePosition
  5.  
  6.  
  7. 'IN THE SELECTEDINDEXCHANGED EVENT OF THE COMBOBOX
  8. If ComboBox.SelectedIndex = 0 then
  9. Me.IsAlteringComboText = True
  10. Me.OldMousePosition = Me.Cursor.Position
  11. Me.Cursor.Position = me.PointToScreen(new point(combobox.location.x+15, combobox.location.Y+15))
  12. end if
  13.  
  14. 'IN THE MOUSEMOVE EVENT OF THE COMBOBOX
  15. if Me.IsAlteringComboText then
  16. Me.IsAlteringComboText = False
  17. Me.ComboBox.Text = "Finally, the beast is dead!"
  18. Me.Cursor.Position = Me.OldMousePosition
  19. End If


This is kinda dirty if you ask me. You might want to put this in a module, or shared functions.


Anyway, hopes this helps
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC