| | |
Issue related to combobox....
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Feb 2006
Posts: 1
Reputation:
Solved Threads: 0
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.
....
This is kinda dirty if you ask me. You might want to put this in a module, or shared functions.
Anyway, hopes this helps
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.
....
VB.NET Syntax (Toggle Plain Text)
'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 'FIRST MAKE 2 PROPERTIES, ONE IS IsAlteringComboText as Boolean 'SECOND ONE IS OldMousePosition 'IN THE SELECTEDINDEXCHANGED EVENT OF THE COMBOBOX If ComboBox.SelectedIndex = 0 then Me.IsAlteringComboText = True Me.OldMousePosition = Me.Cursor.Position Me.Cursor.Position = me.PointToScreen(new point(combobox.location.x+15, combobox.location.Y+15)) end if 'IN THE MOUSEMOVE EVENT OF THE COMBOBOX if Me.IsAlteringComboText then Me.IsAlteringComboText = False Me.ComboBox.Text = "Finally, the beast is dead!" Me.Cursor.Position = Me.OldMousePosition 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
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: my code doest work
- Next Thread: How do i save values of text boxes to database?
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access advanced application array basic beginner browser button buttons center click client code combo convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel exists fade filter forms function html images input lib listview map mobile module monitor msaccess net number objects open panel pdf picturebox picturebox2 port position print printing problem read regex remove right-to-left save search serial settings shutdown socket sorting sqldatbase sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter user usercontol validation vb vb.net vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms winsock wpf wrapingcode xml year





