【Spread for Web Forms】CurrencyCellType隐藏货币符
一开始用GeneralCellType能实现隐藏货币符($),同时格式化数字(###,###,##0),但是却失去了ErrorMessage的功能,不能判断可输入最大值最小值。
参考以下方法
作成以下解决方案
知识点:
System.Globalization 命名空间包含定义区域性相关信息的类,这些信息包括语言、国家/地区、使用的日历、日期、货币和数字的格式模式以及字符串的排序顺序。
Dim dCell As New FarPoint.Web.Spread.GeneralCellType
Dim numFormat As New System.Globalization.NumberFormatInfo
numFormat.NumberDecimalDigits = 0
dCell.NumberFormat = numFormat
dCell.FormatString = "n"
Dim numFormat As New System.Globalization.NumberFormatInfo
numFormat.NumberDecimalDigits = 0
dCell.NumberFormat = numFormat
dCell.FormatString = "n"
参考以下方法
t=System.Threading.Thread.CurrentThread;
oldCulture=t.CurrentCulture;
System.Globalization.CultureInfo newci = (System.Globalization.CultureInfo)oldCulture.Clone();
newci.DateTimeFormat.DayNames=new string[]{"日","一","二","三","四","五","六"};
newci.DateTimeFormat.FirstDayOfWeek=DayOfWeek.Sunday;
t.CurrentCulture=newci;
oldCulture=t.CurrentCulture;
System.Globalization.CultureInfo newci = (System.Globalization.CultureInfo)oldCulture.Clone();
newci.DateTimeFormat.DayNames=new string[]{"日","一","二","三","四","五","六"};
newci.DateTimeFormat.FirstDayOfWeek=DayOfWeek.Sunday;
t.CurrentCulture=newci;
作成以下解决方案
Private t As System.Threading.Thread
Private oldCulture As System.Globalization.CultureInfo
Private Sub FPspread1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles ssList.PreRender
t = System.Threading.Thread.CurrentThread
oldCulture = t.CurrentCulture
Dim newci As System.Globalization.CultureInfo = DirectCast(oldCulture.Clone(), System.Globalization.CultureInfo)
newci.NumberFormat.CurrencySymbol = ""
newci.NumberFormat.NumberDecimalDigits = 0
t.CurrentCulture = newci
End Sub
Private oldCulture As System.Globalization.CultureInfo
Private Sub FPspread1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles ssList.PreRender
t = System.Threading.Thread.CurrentThread
oldCulture = t.CurrentCulture
Dim newci As System.Globalization.CultureInfo = DirectCast(oldCulture.Clone(), System.Globalization.CultureInfo)
newci.NumberFormat.CurrencySymbol = ""
newci.NumberFormat.NumberDecimalDigits = 0
t.CurrentCulture = newci
End Sub
知识点:
System.Globalization 命名空间包含定义区域性相关信息的类,这些信息包括语言、国家/地区、使用的日历、日期、货币和数字的格式模式以及字符串的排序顺序。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
2007-07-11 【ASP.NET】基础补习之验证控件
2007-07-11 【VB.NET】ADO.Net学习(二)DataReader填充DataTable
2007-07-11 【VB.NET】ADO.Net学习(一)DataReader转换为DataSet
2007-07-11 Sql与Asp.Net数据类型对应
2007-07-11 VB.NET and C# Comparison