Results 1 to 10 of 10

Thread: regional and language Problem in vb

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    16

    regional and language Problem in vb

    i have a problem with Regional and language problem.Because when i change the regional language English(united states) to any other language like German(Germany),french etc the application is not running in proper way.

    Problems are as follows:-

    1)it shows froblem in loading loading log details of form
    2)result form dose not show any the output

    example

    command1_click

    if Combo1.text="January" then
    text1.text="hello"
    end if

    insist of showing the out put hello it shows null valu(blank in the textbox)
    if i change again the language to english it shos the proper result

    please help me to overcome the problem thank you in avance
    please send the solution as soon as possible

  2. #2
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: regional and language Problem in vb

    You need to use a resource file to hold every string literal in your application. Whenever you use a string literal, you need to do a lookup in the resource file, grabbing the string for whichever language you're using.

  3. #3
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: regional and language Problem in vb

    In order to have all desciptions/lables etc.. in the correct language, the use of a resource file (like Ellis Dee staed) is the way to go, however the problem discribed sounds different (at least from what I could understand).
    The code you have posted should always show "hello" in the text1.text! However is this code line really used? If you have changed the language, what does the combobox show at selectable items ("January" or "Januar"). Your check will only be true if the item in the combobox does show exact this string ("January").
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  4. #4
    PowerPoster Ellis Dee's Avatar
    Join Date
    Mar 2007
    Location
    New England
    Posts
    3,530

    Re: regional and language Problem in vb

    Quote Originally Posted by opus
    The code you have posted should always show "hello" in the text1.text! However is this code line really used? If you have changed the language, what does the combobox show at selectable items ("January" or "Januar"). Your check will only be true if the item in the combobox does show exact this string ("January").
    Those literals also need to be looked up in the resource file.

    One quick cheat is to use the Format() function to return regional day and month names. (At least I assume it is locale-aware; I could be wrong.)

  5. #5
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: regional and language Problem in vb

    Correct, all strings (if they are .caption of a button or whatsoever) have to be looked up in order to show them correct.
    However if somebody uses the code like above:
    Code:
    command1_click
    
    if Combo1.text="January" then
    text1.text="hello"
    end if
    your regional stting could be anything, the text1.text should always show "hello" and the check in the if statement is always against "January", if I'm not totaly mistaken!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: regional and language Problem in vb

    This sounds familiar... same question yesterday (with more code supplied, and different solutions).

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    16

    Re: regional and language Problem in vb

    thank you for reply opus

    on form load

    i used
    for i=1 to 12
    combo1.additem Monthname(i)
    next

    it shows "januar" when i use german language
    if i use this code]

    command1_click

    if Combo1.text="January" then
    text1.text="hello"
    end if

    how can i over come the problem


    thats why it shows blank in text box.thank you again in advance

  8. #8
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: regional and language Problem in vb

    Use the same technique as in the form_load event, don't assign a hardcoded string, use MonthName(1) instead .
    Code:
    command1_click
    
    if Combo1.text=MonthName(1) then
    text1.text="hello"
    end if
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Mar 2007
    Posts
    16

    Re: regional and language Problem in vb


    you reply solved my problem
    thank you thank u thank u
    im am giving u 10 out of 9 bye

  10. #10
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: regional and language Problem in vb

    If your problem is solved, do us all a favour and mark this threat as resolved using the "Thread Tools" button!
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width