文本框日期格式与区域或单元格格式不匹配 [英] Textbox date format does not match region or cell format

查看:228
本文介绍了文本框日期格式与区域或单元格格式不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel中创建一个表单来显示和更新格式化为日期的单元格( dd。 mm.yyyy)。我的Windows 10上的区域设置也设置为
dd.MM .yyyy(短)和dd MMMM yyyy(长)。然而,当值加载到文本框中时,它显示为
mm / dd / yyyy。

I am creating a form in Excel to show and update a cell formatted as a date (dd.mm.yyyy). The region setting on my Windows 10 is also set to dd.MM.yyyy (short) and dd MMMM yyyy (long). Yet when the value is loaded into a Textbox it displays as mm/dd/yyyy.

如何设置/控制文本框中使用的日期格式?为什么不使用计算机上的区域设置?

How to set/control the date format used in the textbox? Why is it not using the region setting on the computer?

推荐答案

 我认为日期是日期类型而不仅仅是你正在处理的字符串。 如果是这样, 我的猜测是,当您将日期作为字符串分配给TextBox时,需要格式化它们。 例如......

 I would assume that the dates are Date types and not just Strings that you are dealing with.  If so,  my guess would be that you need to format them when you assign the date to a TextBox as a String.  For example...

        Dim SomeDateFromExcellCell As Date = Now
        TextBox1.Text = SomeDateFromExcellCell.ToString("dd/MM/yyyy")


这篇关于文本框日期格式与区域或单元格格式不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆