473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Format enum type problem in Module

Ron
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
Nov 21 '05 #1
10 1874
"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/>
Nov 21 '05 #2
"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/>
Nov 21 '05 #3
Ron
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/>
.

Nov 21 '05 #4
Ron
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/>
.

Nov 21 '05 #5
Ron
I left out that I was also importing

Imports Domino

When I commented that out then the squigly line went away
from the Format function. So there appears to be some
conflict with the Lotus Notes Domino Object Library and
the Format function. Is there a workaround for this?

-----Original Message-----
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 thatdid 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 thatan argument has not been specified for parameterformat... 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 Icould 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/>
.

.

Nov 21 '05 #6
Ron
I left out that I was also importing

Imports Domino

When I commented that out then the squigly line went away
from the Format function. So there appears to be some
conflict with the Lotus Notes Domino Object Library and
the Format function. Is there a workaround for this?

-----Original Message-----
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 thatdid 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 thatan argument has not been specified for parameterformat... 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 Icould 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/>
.

.

Nov 21 '05 #7
Ron,
The "easiest" workaround is to favor DateTime.ToString (& other overridden &
overloaded Object.ToString methods) over VB.Format.

Dim d1 As DateTime
Dim s As String = d1.ToString("MMMM")

The biggest advantage being is you can overload & override ToString in your
own classes, which the promotes consistency, if you cannot overload
VB.Format and still use an Format without qualification.

If you do need to use the VB runtime functions, you can use an Import Alias:

Import VB = Microsoft.VisualBasic

Dim d1 As DateTime
Dim s As String = VB.Format(d1, "MMMM")

Hope this helps
Jay

"Ron" <an*******@discussions.microsoft.com> wrote in message
news:52****************************@phx.gbl...
I left out that I was also importing

Imports Domino

When I commented that out then the squigly line went away
from the Format function. So there appears to be some
conflict with the Lotus Notes Domino Object Library and
the Format function. Is there a workaround for this?

-----Original Message-----
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/>
.

.

Nov 21 '05 #8
Ron,
The "easiest" workaround is to favor DateTime.ToString (& other overridden &
overloaded Object.ToString methods) over VB.Format.

Dim d1 As DateTime
Dim s As String = d1.ToString("MMMM")

The biggest advantage being is you can overload & override ToString in your
own classes, which the promotes consistency, if you cannot overload
VB.Format and still use an Format without qualification.

If you do need to use the VB runtime functions, you can use an Import Alias:

Import VB = Microsoft.VisualBasic

Dim d1 As DateTime
Dim s As String = VB.Format(d1, "MMMM")

Hope this helps
Jay

"Ron" <an*******@discussions.microsoft.com> wrote in message
news:52****************************@phx.gbl...
I left out that I was also importing

Imports Domino

When I commented that out then the squigly line went away
from the Format function. So there appears to be some
conflict with the Lotus Notes Domino Object Library and
the Format function. Is there a workaround for this?

-----Original Message-----
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/>
.

.

Nov 21 '05 #9
Ron
Thank you very much. This is great information. I have
so much to learn about .Net. Your method is way better
than using the Format function.

No squigly lines or anything now :).

Thanks,
Ron

-----Original Message-----
Ron,
The "easiest" workaround is to favor DateTime.ToString (& other overridden &overloaded Object.ToString methods) over VB.Format.

Dim d1 As DateTime
Dim s As String = d1.ToString("MMMM")

The biggest advantage being is you can overload & override ToString in yourown classes, which the promotes consistency, if you cannot overloadVB.Format and still use an Format without qualification.

If you do need to use the VB runtime functions, you can use an Import Alias:
Import VB = Microsoft.VisualBasic

Dim d1 As DateTime
Dim s As String = VB.Format(d1, "MMMM")

Hope this helps
Jay

"Ron" <an*******@discussions.microsoft.com> wrote in messagenews:52****************************@phx.gbl...
I left out that I was also importing

Imports Domino

When I commented that out then the squigly line went away from the Format function. So there appears to be some
conflict with the Lotus Notes Domino Object Library and
the Format function. Is there a workaround for this?

-----Original Message-----
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/>
.

.

.

Nov 21 '05 #10
Ron
Thank you very much. This is great information. I have
so much to learn about .Net. Your method is way better
than using the Format function.

No squigly lines or anything now :).

Thanks,
Ron

-----Original Message-----
Ron,
The "easiest" workaround is to favor DateTime.ToString (& other overridden &overloaded Object.ToString methods) over VB.Format.

Dim d1 As DateTime
Dim s As String = d1.ToString("MMMM")

The biggest advantage being is you can overload & override ToString in yourown classes, which the promotes consistency, if you cannot overloadVB.Format and still use an Format without qualification.

If you do need to use the VB runtime functions, you can use an Import Alias:
Import VB = Microsoft.VisualBasic

Dim d1 As DateTime
Dim s As String = VB.Format(d1, "MMMM")

Hope this helps
Jay

"Ron" <an*******@discussions.microsoft.com> wrote in messagenews:52****************************@phx.gbl...
I left out that I was also importing

Imports Domino

When I commented that out then the squigly line went away from the Format function. So there appears to be some
conflict with the Lotus Notes Domino Object Library and
the Format function. Is there a workaround for this?

-----Original Message-----
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/>
.

.

.

Nov 21 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Moe Green | last post by:
I want create a method which uses a dynamically enum as the type of one of its parameters. I can create the assembly with this code: AssemblyName myAssemblyName = new AssemblyName();...
2
by: Filip Wtterwulghe | last post by:
Hello, I have have module where I have created a public enumtype that I want to reuse in different classes . As soon as I create a public property with this type . Vb warns me that the...
16
by: Chad | last post by:
In VB6, Enums that I declare within a class as PUBLIC are know outside of this class. In otehr words, the enum is global and may be referenced outside of the class in which it is declared. In...
0
by: Ron | last post by:
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...
6
by: Jason Larion | last post by:
When working with enums, I've noticed some behaviour that seems completely counter-intuitive to me. I was wondering if someone here could help restore my sanity, or at least help me to understand...
13
by: Don | last post by:
How do I get an Enum's type using only the Enum name? e.g. Dim enumType as System.Type Dim enumName as String = "MyEnum" enumType = ???(enumName)
3
by: K. Wilder | last post by:
I need to declare a project level Enum that any procedure in any class can reference so there's continuity with the values. How do I do this? At present, if I declare a Module in a project and...
3
by: shapper | last post by:
Hello, I have an enum: Public Enum Color Red Blue Green End Enum
1
by: BobRoyAce | last post by:
I have a module that defines, among other things, an Enum: --- MODULE CODE BEGINS --- Namespace OMEGA.GRP Module Globals ... Public Enum FileProcessingStatus None Processing = 1 Completed =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.