Results 1 to 2 of 2

Thread: How Change the Regional Settings from vb

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    India
    Posts
    2

    Question

    Hi Everybody,

    Is it possible to change the system date to "dd/mm/yyyy" and time to "HH:mm:ss" format through vb code? If so please let me know how!!!! And Is It possible to deny access to the control panel of windows 9x versions through vb?
    Sriram

  2. #2
    New Member
    Join Date
    Oct 2000
    Posts
    1

    Thumbs up

    SetLocaleInfo, can be used to set a wide range of regional settings.

    Add the following in the declarations section of our project's code module:


    Public Const LOCALE_SSHORTDATE = &H1F

    Public Declare Function GetSystemDefaultLCID _
    Lib "kernel32" () As Long

    Public Declare Function SetLocaleInfo Lib _
    "kernel32" Alias "SetLocaleInfoA" ( _
    ByVal Locale As Long, _
    ByVal LCType As Long, _
    ByVal lpLCData As String) As Boolean



    Private Sub Main()
    Dim lngLocale As Long

    lngLocale = GetSystemDefaultLCID()

    If SetLocaleInfo(lngLocale, _
    LOCALE_SSHORTDATE, _
    "MM/dd/yyyy") = _
    False Then
    ' Handle error, possibly by writing it
    ' to a server error log
    End If

    End Sub


    I hope the above code will help as I was also strugling on the net to find its solution.

    Enjoy,

    Neeraj Matta.

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