ApplicationBase.UICulture Eigenschaft
Definition
Ruft die Kultur ab, die der aktuelle Thread zum Abrufen von kulturspezifischen Ressourcen verwendet.Gets the culture that the current thread uses for retrieving culture-specific resources.
public:
property System::Globalization::CultureInfo ^ UICulture { System::Globalization::CultureInfo ^ get(); };
public System.Globalization.CultureInfo UICulture { get; }
member this.UICulture : System.Globalization.CultureInfo
Public ReadOnly Property UICulture As CultureInfo
Eigenschaftswert
Ein CultureInfo-Objekt, das die Kultur darstellt, die der aktuelle Thread zum Abrufen von kulturspezifischen Ressourcen verwendet.A CultureInfo object that represents the culture that the current thread uses for retrieving culture-specific resources.
Beispiele
In diesem Beispiel wird die- My.Application.CurrentCulture
Eigenschaft verwendet, um die aktuelle Kultur zwischenzuspeichern, bevor Sie mit geändert wird ChangeUICulture .This example uses the My.Application.CurrentCulture
property to cache the current culture before changing it by using ChangeUICulture. Die- My.Application.ChangeUICulture
Methode legt die Kulturfest, die vom- My.Resources
Objekt zum Abrufen von Ressourcen verwendet wird.The My.Application.ChangeUICulture
method sets the culture that the My.Resources
object uses for retrieving resources.
Sub ShowLocalizedMessage()
Dim culture As String = My.Application.UICulture.Name
My.Application.ChangeUICulture("fr-FR")
MsgBox(My.Resources.Message)
My.Application.ChangeUICulture(culture)
End Sub
Damit dieses Beispiel funktioniert, muss Ihre Anwendung über eine Zeichenfolge mit dem Namen Message
in der Ressourcen Datei der Anwendung verfügen, und die Anwendung sollte über die französische Kultur Version der Ressourcen Datei verfügen Resources.fr-FR.resx
.For this example to work, your application must have a string named Message
in the application's resource file, and the application should have the French-culture version of that resource file, Resources.fr-FR.resx
. Weitere Informationen finden Sie unter Vorgehens Weise: Hinzufügen oder Entfernen von Ressourcen.For more information, see How to: Add or Remove Resources.
Wenn die Anwendung nicht über die französische Kultur Version der Ressourcen Datei verfügt, ruft das- My.Resources
Objekt die Ressource aus der Standard-Culture-Ressourcen Datei ab.If the application does not have the French-culture version of that resource file, the My.Resources
object retrieves the resource from the default-culture resource file.
Hinweise
Die- My.Application.CurrentUICulture
Eigenschaft ruft das- CultureInfo Objekt ab, das der aktuelle Thread zum Abrufen von kulturspezifischen Ressourcen verwendet.The My.Application.CurrentUICulture
property gets the CultureInfo object that the current thread uses for retrieving culture-specific resources. Dieses Objekt ist mit dem Objekt identisch, das von der-Eigenschaft zurückgegeben wird CurrentUICulture .This object is identical to the one returned by the CurrentUICulture property. Die CurrentUICulture -Eigenschaft bestimmt die Kultur, die von der Ressourcen-Manager und dem My.Resources
Objekt verwendet wird, um Informationen zu erhalten, die für die Suche nach Kultur abhängigen Ressourcen zur Laufzeit erforderlich sind.The CurrentUICulture property determines the culture used by the Resource Manager and the My.Resources
object, information it needs to look up culture-specific resources at run time.
Um die Kultur zu ändern, können Sie die- ChangeUICulture Methode verwenden oder der-Eigenschaft ein anderes- CultureInfo Objekt zuweisen CurrentUICulture .To change the culture, you can use the ChangeUICulture method or assign a different CultureInfo object to the CurrentUICulture property.
Diese CurrentCulture Einstellung unterscheidet sich von einer Spracheinstellung.The CurrentCulture setting is different from a language setting. Sie enthält nur Daten, die sich auf die Standardeinstellungen für eine geografische Region beziehen.It contains only data related to the standard settings for a geographical region.
Verwenden Sie die- My.Application.CurrentCulture
Eigenschaft, um die Kultur, die der aktuelle Thread für Zeichen folgen Bearbeitung und Zeichen folgen Formatierung verwendet, zu erhalten.Use the My.Application.CurrentCulture
property to get the culture that the current thread uses for string manipulation and string formatting.
Verfügbarkeit nach ProjekttypAvailability by Project Type
ProjekttypProject type | VerfügbarAvailable |
---|---|
Windows Forms-AnwendungWindows Forms Application | JaYes |
KlassenbibliothekClass Library | JaYes |
KonsolenanwendungConsole Application | JaYes |
Windows Forms-SteuerelementbibliothekWindows Forms Control Library | JaYes |
WebsteuerelementbibliothekWeb Control Library | NeinNo |
Windows-DienstWindows Service | JaYes |
WebsiteWeb Site | NeinNo |