Jump to content

Changing textbox default text input mode


Guest Jamma14

Recommended Posts

Guest Jamma14

Hiya, if I want to set the default input mode fo a textbox to say 123 or abc rather than t9 which is does at the moment, how would I go about it??

Can't find code anywhere that'll help.

Thanks, James

Link to comment
Share on other sites

Guest Jamma14

Imports System.Runtime.InteropServices


Public Const EM_SETINPUTMODE As Integer = &HDE

Public Const EIM_SPELL As Integer = 0

Public Const EIM_AMBIG As Integer = 1

Public Const EIM_NUMBERS As Integer = 2


<DllImport("coredll.dll")> _

Public Shared Function GetFocus() As IntPtr

End Function


<DllImport("coredll.dll")> _

Public Shared Function SendMessage(ByVal hWnd As IntPtr, _

  ByVal Message As Integer, ByVal wParam As Integer, _

  ByVal lParam As Integer) As Integer

End Function


'Sample use setting TextBox to number input

Private Sub txtAmount_GotFocus(ByVal sender As Object, _

  ByVal e As System.EventArgs) Handles txtAmount.GotFocus

  

    Dim hWnd As IntPtr

    hWnd = Me.GetFocus()

    SendMessage(hWnd, EM_SETINPUTMODE, 0, EIM_NUMBERS)

    txtAmount.SelectionStart = txtAmount.Text.Length


End Sub

Okay found this example on MSDN, but it's telling me "DllImport is not defined". :|

Sorry if I'm being retarded btw, this is my first attempt at smartphone programming in VB .net. :)

EDIT: Don't worry, was being retarded, put "Imports System.Runtime.InteropServices" in the wrong place. :roll:

James

Edited by Jamma14
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.