C#获取当前系统语言

C#获取当前系统语言,第1张

1、作用SystemGlobalizationCultureInfoInstalledUICultureNativeName获取。

MessageBoxShow(SystemGlobalizationCultureInfoInstalledUICultureNativeName);

效果如下:

2、InstalledUICultureNativeName说明:

NativeName 属性

  获取为区域性设置的显示名称,它由语言、国家/地区以及可选的书写符号组成。

命名空间:  SystemGlobalization

语法

  public virtual string NativeName { get; }

属性值

  类型:SystemString

  区域性名称。 由语言全名、国家/地区全名以及可选的书写符号组成的区域性名称。 有关 其格式的讨论,请参见对 CultureInfo 类的说明。

int count = 0;

string str_out = stringEmpty;

do

{

if (!readerHasRows)

break;

while (readerRead())

{

string temp = ConvertToString(reader["字段名"]);

if (stringIsNullOrEmpty(temp))

continue;

count++;

str_out += temp + "\r\n";

}

MessageBoxShow(str_out);

} while (false);

其实获取个数的话可以用SQL的,查出来之后直接取出值,你说的还要分割字符串是什么意思?没理解,难道你的数据库里面存的航班信息是写在一起的?

下面是这个函数的原型:

[SystemSecuritySecurityCritical]

public static SystemWindowsMessageBoxResult Show (string messageBoxText, string caption, SystemWindowsMessageBoxButton button, SystemWindowsMessageBoxImage icon);

可以看到,函数的返回类型是SystemWindowsMessageBoxResult类型,而不是DialogResult类型,给出一个官方文档供你参考:文档

可以这么写:

if(MessageBoxShow("内容?","对话框标题", MessageBoxButtonsOKCancel, MessageBoxIconQuestion) ==MessageBoxResultOK)

{

// 点击确定后执行的代码

}

else

{

// 取消后的代码

}

以上就是关于C#获取当前系统语言全部的内容,包括:C#获取当前系统语言、C#中MessageBox输出信息、wpf中DialogResult方法报错等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9545310.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-29
下一篇2023-04-29

发表评论

登录后才能评论

评论列表(0条)

    保存