Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
Change Regional Setting For Short date
Author:
Mkpandey
E-mail:
Click to e-mail author
Submitted:
5/4/2004
Version:
VB5
Compatibility:
VB5, VB6
Category:
Date/Time
Views:
31979
Many times you need that your/client's system must have some specific short date setting, e.g. dd/MM/yyyy. Here is the simplest and fullproof way to make this possible. ------------------------------------------ How To Do This: Add One Command Button and a TextBox in your form and copy these codes. ------------------------------------------ Enjoy Coding..... ;-) Manu manu_mcs@rediffmail.com
Declarations:
Option Explicit Private Const LOCALE_SSHORTDATE = &H1F Private Declare Function GetSystemDefaultLCID Lib "kernel32" () As Long Private Declare Function SetLocaleInfo Lib "kernel32" Alias "SetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String) As Boolean Private Declare Function GetLocaleInfo Lib "kernel32" Alias "GetLocaleInfoA" (ByVal Locale As Long, ByVal LCType As Long, ByVal lpLCData As String, ByVal cchData As Long) As Long Dim lLocal As Long
Code:
Private Sub Command1_Click() lLocal = GetSystemDefaultLCID() If SetLocaleInfo(lLocal, LOCALE_SSHORTDATE, "dd/MM/yyyy") = False Then 'You can write your own handler in this area End If End Sub Private Sub Form_Load() Dim length As Long Dim buf As String * 1024 lLocal = GetSystemDefaultLCID() length = GetLocaleInfo(lLocal, LOCALE_SSHORTDATE, buf, Len(buf)) Text1.Text = Left$(buf, length - 1) End Sub
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement