VB.Net by API/System.Globalization/CultureInfo — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Текущая версия на 12:50, 26 мая 2010

CultureInfo.DateTimeFormat

  
Imports System
Imports System.Data
Imports System.Globalization
Public Class Tester
    Public Shared Sub Main
    
        Dim amount As Double = 4.52
        Dim _date As DateTime = DateTime.Now
        Dim info As CultureInfo
        For Each info In CultureInfo.GetCultures(CultureTypes.AllCultures)
            Console.WriteLine(info.EnglishName)
            Console.WriteLine(info.Name)
            If Not info.IsNeutralCulture Then
                Console.WriteLine(amount.ToString("C", info.NumberFormat))
                Console.WriteLine(_date.ToString("d", info.DateTimeFormat))
            End If
        Next
    End Sub
End Class


CultureInfo.GetCultures

  
Imports System
Imports System.Data
Imports System.Globalization
Public Class Tester
    Public Shared Sub Main
    
        Dim amount As Double = 4.52
        Dim _date As DateTime = DateTime.Now
        Dim info As CultureInfo
        For Each info In CultureInfo.GetCultures(CultureTypes.AllCultures)
            Console.WriteLine(info.EnglishName)
            Console.WriteLine(info.Name)
            If Not info.IsNeutralCulture Then
                Console.WriteLine(amount.ToString("C", info.NumberFormat))
                Console.WriteLine(_date.ToString("d", info.DateTimeFormat))
            End If
        Next
    End Sub
End Class


CultureInfo.NumberFormat

  
Imports System
Imports System.Data
Imports System.Globalization
Public Class Tester
    Public Shared Sub Main
    
        Dim amount As Double = 4.52
        Dim _date As DateTime = DateTime.Now
        Dim info As CultureInfo
        For Each info In CultureInfo.GetCultures(CultureTypes.AllCultures)
            Console.WriteLine(info.EnglishName)
            Console.WriteLine(info.Name)
            If Not info.IsNeutralCulture Then
                Console.WriteLine(amount.ToString("C", info.NumberFormat))
                Console.WriteLine(_date.ToString("d", info.DateTimeFormat))
            End If
        Next
    End Sub
End Class


New CultureInfo(String inf)

  

Imports System
Imports System.Data
Imports System.Globalization
Imports System.Threading
public class Test
   public Shared Sub Main
        Thread.CurrentThread.CurrentCulture = New CultureInfo("de-DE")
        Thread.CurrentThread.CurrentUICulture = New CultureInfo("de-DE")
   End Sub
End class