checking textbox string

Discussion in 'Questions (Windows Mobile)' started by derez, Oct 21, 2007.

  1. derez

    derez Expert Licensed User

    :sign0085:

    Hi
    I am puzzled by an inconsistency between the device and the desktop.
    I attach a small program to demonstrae it.
    when pressing the button, I check a textbox text if it is empty and if yes - put minus, else plus:

    If textbox1.Text = "" Then textbox1.Text = "-" Else textbox1.Text = "+"

    when run on desktop it works, on the device I always get +

    :sign0163:
     

    Attached Files:

    • test.sbp
      File size:
      521 bytes
      Views:
      23
  2. specci48

    specci48 Well-Known Member Licensed User

    Hm ... your code works fine on my wm5 device ...
    Are you sure you haven't got a space as a default value for the textbox on the device?
     
    Last edited: Oct 21, 2007
  3. Erel

    Erel Administrator Staff Member Licensed User

    I've checked it also and it works fine.
     
  4. agraham

    agraham Expert Licensed User

    Fine for me also!
     
  5. derez

    derez Expert Licensed User

    textbox

    Must be something wrong in my installed Basic4ppc.
    I was confronted with the problem in an application that I work on, and built this small program to check it, and in both the same problem.

    Anyway, I went around it with a flag instead of checking the textbox.

    Thanks to all of you.
     
  6. dzt

    dzt Active Member Licensed User

    Hi,

    What about StrLength(textbox1.Text)?
     
  7. derez

    derez Expert Licensed User

    Dzt

    Of course this looks as a nice go-around, but amazingly it doesn't work.
    I modified the test program, the sequence that should be written in the textbox is "-+++" using either button.
    This is ok on the desktop but on the device - nothing is written !
    I checked it on another MIO350 - the same result.
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    I don't see this problem when I test it.
    Please add:
    Msgbox(StrLength(textbox1.Text))
    before the condition statement and check the initial value.
     
  9. dzt

    dzt Active Member Licensed User

    Very strange.
    Try also at App_Start or somewhere else textbox1.text = ""
     
  10. derez

    derez Expert Licensed User

    textbox

    Erel - Your guess was right, the length is 1 !
    I checked by ASC() and it is 0 (zero)

    dzt - what you suggested did not change the situation

    I checked the same code on a control button instead of textbox - it works fine.
     
  11. Erel

    Erel Administrator Staff Member Licensed User

    I've seen strange behaviors on devices with Hebrew installed.
    Try to change the regional settings to United States.
    Another thing you could try is to disable the Hebrew software.
     
  12. derez

    derez Expert Licensed User

    Erel

    I tried playing with the Hebrew (without disabling it completely) - no success.
    Anyway - knowing about it is almost like solving it, since I use other ways for the code.

    thanks

    by the way - have you looked at the email from yesterday about the lost colors ?
     
  13. Erel

    Erel Administrator Staff Member Licensed User

    Yes. Didn't you receive my reply?
    You should install .Net CF 1.0 SP3 on your device and it will fix it.
     
  14. derez

    derez Expert Licensed User

    colors

    Erel

    I'm at work and can't see that email account, but your answer makes me feel very stupid, I should have thought about it myself !:signOops:

    Thank you very much !:sign0098:
     
Loading...