|
-
Jun 17th, 2009, 08:38 PM
#1
Thread Starter
Addicted Member
[RESOLVED] e.KeyChar in CF
Hi all,
I want to know how can I achieve below VB.Net [Windows] code in CF environment?
Thanks.
VB.Net Code:
Private Sub txtRemark2_KeyPress(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtRemark2.KeyPress
If IsNumeric(e.KeyChar) = True Then
Else
' This is just an example. In actual, I will change the value to correspond key value.
e.KeyChar = "5"c
End If
End Sub
In Windows application, e.KeyChar is not read only so I can assign value back to it and it will reflect on textbox.
But in CF, it is read only that means I can't assign value to it. 
Although in Object Browser, it said its "Gets" and "Sets", i can't assign value to it.
(Why the object browser shows us incorrect definition?????) 
When I assign value, it will highlight and said this is 'Read Only' 
Anybody can help me???
Thanks.
-
Jun 18th, 2009, 03:03 AM
#2
Frenzied Member
Re: e.KeyChar in CF
Hi,
you will probably have to do something like
If IsNumeric(e.KeyChar) Then
Else
txtRemark2.Text = txtRemark2.Text.Substring(0, txtRemark2.TextLength) & "5"
txtRemark2.SelectionStart = txtRemark2.TextLength
e.Handled = True
End If
in the above example
That should do it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|