TextBox - what is going wrong?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • M O J O

    TextBox - what is going wrong?

    Hi,

    I have a TextBox on my form.

    I capture the KeyDown event and examines the e.KeyValue - that is, I
    examine it like this: dim chr = chr(KeyValue).

    This seams to work ok .... well almost.

    In Denmark we have some special characters like this one (hope you can
    see it): "ø", which is a circle with a line through it.

    The text box writes the special characters without any problem, but the
    chr(e.KeyValue) shows a strange character and e.KeyCOde & e.KeyData
    writes OemQuotes.

    What is going on here? Do I have to set some kind of localize info??

    Thanks!!

    M O J O

  • Jeremy Cowles

    #2
    Re: TextBox - what is going wrong?

    "M O J O" <mojo@____no___ _spa_m___newweb solutions.dk> wrote in message
    news:3F16B9B7.4 080404@____no__ __spa_m___newwe bsolutions.dk.. .[color=blue]
    > Hi,
    >
    > I have a TextBox on my form.
    >
    > I capture the KeyDown event and examines the e.KeyValue - that is, I
    > examine it like this: dim chr = chr(KeyValue).
    >
    > This seams to work ok .... well almost.
    >
    > In Denmark we have some special characters like this one (hope you can
    > see it): "ø", which is a circle with a line through it.
    >
    > The text box writes the special characters without any problem, but the
    > chr(e.KeyValue) shows a strange character and e.KeyCOde & e.KeyData
    > writes OemQuotes.
    >
    > What is going on here? Do I have to set some kind of localize info??
    >[/color]

    Wierd, it works for me (ø = ALT+0248) - when I key it into a text box, it
    works with the following code just fine (KeyPress):

    Debug.WriteLine (e.KeyChar)
    If e.KeyChar = Chr(248) Then
    MsgBox(e.KeyCha r)
    End If

    But since I don't have a keyboard that has that symbol, I can't test with
    key-down... So I guess this is no help. Sorry.

    Jeremy

    Comment

    • Armin Zingler

      #3
      Re: TextBox - what is going wrong?

      "M O J O" <mojo@____no___ _spa_m___newweb solutions.dk> schrieb[color=blue]
      > I have a TextBox on my form.
      >
      > I capture the KeyDown event and examines the e.KeyValue - that is, I
      > examine it like this: dim chr = chr(KeyValue).
      >
      > This seams to work ok .... well almost.
      >
      > In Denmark we have some special characters like this one (hope you
      > can see it): "ø", which is a circle with a line through it.
      >
      > The text box writes the special characters without any problem, but
      > the chr(e.KeyValue) shows a strange character and e.KeyCOde &
      > e.KeyData writes OemQuotes.
      >
      > What is going on here? Do I have to set some kind of localize
      > info??[/color]

      Keydown is used to receive keys, not chars. Use Keypress to evaluate chars.
      Keyvalues are not character values. For example, pressing the "A" key fires
      keydown with keycode = Keys.A, but the resulting char might be "a", "A", or
      chr(1) depending on the state of the shift and ctrl keys. Another example:
      function keys. They produce keydown events but no keypress events because
      they are not translated to chars.

      Armin

      Comment

      Working...