在Module中格式化枚举类型问题 [英] Format enum type problem in Module

查看:57
本文介绍了在Module中格式化枚举类型问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


以下代码适用于Form类模块,但不适用于

标准模块:

Dim d1作为DateTime

格式(d1,MMMM)


在一个标准模块中,我得到一个简洁的线条说

参数格式没有被指定...

所以我试过这个:


格式(GetType(DateTime),d1," MMMM" )


但现在我收到错误消息,提供的类型

必须是枚举。任何建议都赞赏我如何解决这个问题。我需要列举什么?


谢谢,

Ron

解决方案

"罗恩" <一个******* @ discussions.microsoft.com> schrieb:

以下代码适用于Form类模块,但不适用于
标准模块:
Dim d1 As DateTime
格式(d1,MMMM)

在一个标准模块中,我得到了一条曲线,说没有为参数格式指定
参数......
所以我试过了:

格式(GetType(DateTime),d1," MMMM")

但现在我收到错误消息,提供的类型必须是枚举。任何建议都赞赏我如何解决这个问题。我需要列举什么?




您在表单和模块中有哪些导入?


-

Herfried K. Wagner [MVP]

< URL:http://dotnet.mvps.org/>

"罗恩" <一个******* @ discussions.microsoft.com> schrieb:

以下代码适用于Form类模块,但不适用于
标准模块:
Dim d1 As DateTime
格式(d1,MMMM)

在一个标准模块中,我得到了一条曲线,说没有为参数格式指定
参数......
所以我试过了:

格式(GetType(DateTime),d1," MMMM")

但现在我收到错误消息,提供的类型必须是枚举。任何建议都赞赏我如何解决这个问题。我需要列举什么?




您在表单和模块中有哪些导入?


-

Herfried K. Wagner [MVP]

< URL:http://dotnet.mvps.org/>

我有


进口System.Data.OleDb

进口System.IO


表格


和标准单元中我有


进口系统

进口System.Data.OleDb


我将Imports System.IO添加到标准模块,但是

没有任何帮助。有什么想法吗?


谢谢

-----原帖-----
"罗恩" <一个******* @ discussions.microsoft.com> schrieb:

以下代码适用于Form类模块,但不适用于
a标准模块:
Dim d1 As DateTime
Format(d1," MMMM")

在一个标准模块中,我得到了一个描述
参数
格式的参数,因此我尝试了这个:
格式(GetType(DateTime),d1," MMMM")

但现在我收到错误消息,提供的类型必须是枚举。任何建议都赞赏我
可以解决这个问题。我需要列举什么?



您在表单和模块中有哪些导入?

-
Herfried K. Wagner [MVP]
< URL:http://dotnet.mvps.org/>



Hello,

The following code works in a Form class module but not a
standard module:
Dim d1 As DateTime
Format(d1, "MMMM")

In a standard module I get a squigly line saying that an
argument has not been specified for parameter format...
So I tried this:

Format(GetType(DateTime), d1, "MMMM")

but now I get the error message that the type provided
must be an enum. Any suggestions appreciated how I could
resolve this. What do I have to enumerate?

Thanks,
Ron

解决方案

"Ron" <an*******@discussions.microsoft.com> schrieb:

The following code works in a Form class module but not a
standard module:
Dim d1 As DateTime
Format(d1, "MMMM")

In a standard module I get a squigly line saying that an
argument has not been specified for parameter format...
So I tried this:

Format(GetType(DateTime), d1, "MMMM")

but now I get the error message that the type provided
must be an enum. Any suggestions appreciated how I could
resolve this. What do I have to enumerate?



What imports do you have in your form and in your module?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


"Ron" <an*******@discussions.microsoft.com> schrieb:

The following code works in a Form class module but not a
standard module:
Dim d1 As DateTime
Format(d1, "MMMM")

In a standard module I get a squigly line saying that an
argument has not been specified for parameter format...
So I tried this:

Format(GetType(DateTime), d1, "MMMM")

but now I get the error message that the type provided
must be an enum. Any suggestions appreciated how I could
resolve this. What do I have to enumerate?



What imports do you have in your form and in your module?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


I have

Imports System.Data.OleDb
Imports System.IO

in the Form

and in the Standard Module I have

Imports System
Imports System.Data.OleDb

I added Imports System.IO to the standard module, but that
did not help anything. Any ideas?

Thanks

-----Original Message-----
"Ron" <an*******@discussions.microsoft.com> schrieb:

The following code works in a Form class module but not a standard module:
Dim d1 As DateTime
Format(d1, "MMMM")

In a standard module I get a squigly line saying that an argument has not been specified for parameter format... So I tried this:

Format(GetType(DateTime), d1, "MMMM")

but now I get the error message that the type provided
must be an enum. Any suggestions appreciated how I could resolve this. What do I have to enumerate?



What imports do you have in your form and in your module?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
.



这篇关于在Module中格式化枚举类型问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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