473,546 Members | 2,244 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1888
"Ron" <an*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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.Ole Db
Imports System.IO

in the Form

and in the Standard Module I have

Imports System
Imports System.Data.Ole Db

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

Thanks

-----Original Message-----
"Ron" <an*******@disc ussions.microso ft.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.Ole Db
Imports System.IO

in the Form

and in the Standard Module I have

Imports System
Imports System.Data.Ole Db

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

Thanks

-----Original Message-----
"Ron" <an*******@disc ussions.microso ft.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.Ole Db
Imports System.IO

in the Form

and in the Standard Module I have

Imports System
Imports System.Data.Ole Db

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

Thanks

-----Original Message-----
"Ron" <an*******@disc ussions.microso ft.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.Ole Db
Imports System.IO

in the Form

and in the Standard Module I have

Imports System
Imports System.Data.Ole Db

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

Thanks

-----Original Message-----
"Ron" <an*******@disc ussions.microso ft.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.ToStri ng (& other overridden &
overloaded Object.ToString methods) over VB.Format.

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

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.Visua lBasic

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

Hope this helps
Jay

"Ron" <an*******@disc ussions.microso ft.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.Ole Db
Imports System.IO

in the Form

and in the Standard Module I have

Imports System
Imports System.Data.Ole Db

I added Imports System.IO to the standard module, but

that
did not help anything. Any ideas?

Thanks

-----Original Message-----
"Ron" <an*******@disc ussions.microso ft.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.ToStri ng (& other overridden &
overloaded Object.ToString methods) over VB.Format.

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

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.Visua lBasic

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

Hope this helps
Jay

"Ron" <an*******@disc ussions.microso ft.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.Ole Db
Imports System.IO

in the Form

and in the Standard Module I have

Imports System
Imports System.Data.Ole Db

I added Imports System.IO to the standard module, but

that
did not help anything. Any ideas?

Thanks

-----Original Message-----
"Ron" <an*******@disc ussions.microso ft.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.ToStri ng (& other overridden &overloaded Object.ToString methods) over VB.Format.

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

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.Visua lBasic

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

Hope this helps
Jay

"Ron" <an*******@disc ussions.microso ft.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.Ole Db
Imports System.IO

in the Form

and in the Standard Module I have

Imports System
Imports System.Data.Ole Db

I added Imports System.IO to the standard module, but

that
did not help anything. Any ideas?

Thanks
-----Original Message-----
"Ron" <an*******@disc ussions.microso ft.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

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

Similar topics

5
2075
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(); myAssemblyName.Name = "EmittedAssembly"; // Create the dynamic assembly. myAssemblyBuilder = myAppDomain.DefineDynamicAssembly(myAssemblyName,
2
3216
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 'Friend' type can not be used as a public type . Option Strict is on , so it's possible that this problem only occurs in this case .
16
8359
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 VB.Net, a Public enum is local to the class in which it is declared or instances of the class or classes that inherit from the class in which the Enum...
0
307
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 not been specified for parameter format... So I tried this:
6
4610
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 the "why" of the behaviour. After dimensioning an enum of type integer, any attribute referenced seems to, by default, return the name of that...
13
12364
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
3897
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 want to refer to it in an class I get the following error: cannot expose type outside the project through class
3
5224
by: shapper | last post by:
Hello, I have an enum: Public Enum Color Red Blue Green End Enum
1
1268
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 = 2
0
7507
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7947
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7461
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5361
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3492
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3472
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1922
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1046
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.