Monday, January 23, 2006

VS 2005 & VB.NET Combobox readonly

I have a combobox in VS2005 that is read only when compiled for Pocket PC. The same code in VB for the desktop creates a combobox in which the user can type some free text (wierd?). Although the changes aren't saved as any of the choices, this is still no good as it gives the user the impression that the value he/she typed in is the value that is being processed by the program when the submit/enter button is clicked on my app to produce a calculation.



After searching forever, I found someone who posted an elegant solution:



[vb.net]
Private Sub comboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles cmbTipo.KeyPress
e.Handled = True
End Sub



http://www.codeproject.com/cs/miscctrl/ReadOnlyComboBox.asp#xx1093207xx

1 comment:

  1. The production of aluminum sheet metal is carried out when aluminum materials is pressed and rolled under high stress. Aluminum sheets are typically light-weight but additionally possess enough strength to be helpful in quite a few business functions. Aluminum metal sheet is exceptionally versatile and is straightforward to fabricate, making it among the hottest of CNC machining the metal sheets obtainable on the market. Standard kind magnetic stainless for sheet metal fabrication is the four hundred collection.

    ReplyDelete