473,320 Members | 1,848 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,320 software developers and data experts.

enum problem

Hi all,

Here is an interesting dilemma. I have a .cs proxy client stub for a remote
web service. It has an enum defined as follows:-

/// <remarks/>
public enum AssetClassType {

/// <remarks/>
NEW,

/// <remarks/>
USED,
}

Now i am writing a vb dll that uses the classes in this proxy stub and I am
running into a vb compiler error on the following line:-

c._Class = CBT.SOAP.Client.AssetClassType.NEW

The error is:-

Type CBT.SOAP.Client.AssetClassType has no constructors.

Any ideas? I cannot change the .cs file.
Nov 21 '05 #1
3 1461
<pa***@community.nospam> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl...
Hi all,

Any ideas? I cannot change the .cs file.


Not sure about .Net but I thought I'd throw this in anyway....

In VB5/6, if you want to use a reserved word as an enum member you have to
wrap it in brackets... if the rules are similar for .Net, you'll probably
have to change the cs file.
'=======
Option Explicit

Public Enum Test
[New] = 10
Used
End Enum
Private Sub Form_Load()
Debug.Print Test.New 'shows 10
End Sub
'=======

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Nov 21 '05 #2
"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:uU**************@tk2msftngp13.phx.gbl...


Private Sub Form_Load()
Debug.Print Test.New 'shows 10
End Sub
'=======


While I'm at it, I might as well add.... enums with keywords and/or spaces,
wrapped in brackets are also wrapped in brackets automatically by VB when
you attempt to use them (assuming you let intellisense do the typing)
'=========
Option Explicit

Public Enum AnotherTest
[New Enum] = 10
AnythingElse
End Enum

Private Sub Form_Load()
Debug.Print AnotherTest.[New Enum] 'shows 10
End Sub
'=========

So, maybe, if once it gets to the B# side, you can wrap it in brackets so B#
"knows" you're not attempting to use the reserved word (may not have to
modify the cs file)

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Nov 21 '05 #3
<pa***@community.nospam> schrieb:
Here is an interesting dilemma. I have a .cs proxy client stub for a
remote web service. It has an enum defined as follows:-

/// <remarks/>
public enum AssetClassType {

/// <remarks/>
NEW,

/// <remarks/>
USED,
}

Now i am writing a vb dll that uses the classes in this proxy stub and I
am running into a vb compiler error on the following line:-

c._Class = CBT.SOAP.Client.AssetClassType.NEW

The error is:-

Type CBT.SOAP.Client.AssetClassType has no constructors.


=>

'c._Class = CBT.SOAP.Client.AssetClassType.[New]'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

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

Similar topics

11
by: Alexander Grigoriev | last post by:
Not quite new version of GCC that I have to use, craps with the following code: enum E; enum E { e }; That is, it doesn't accept forward declaration of enum. C++ standard text doesn't...
0
by: Vaclav Haisman | last post by:
Motivation: I have been working on some project recently that uses lots of enums with disjunctive intervals of values because it is rather convenient way to define series of constants with...
6
by: James Brown | last post by:
Hi, I have the following enum declared: enum TOKEN { TOK_ID = 1000, TOK_NUMBER, TOK_STRING, /*lots more here*/ }; What I am trying to do is _also_ represent ASCII values 0-127 as TOKENs...
21
by: Andreas Huber | last post by:
Hi there Spending half an hour searching through the archive I haven't found a rationale for the following behavior. using System; // note the missing Flags attribute enum Color {
18
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have created an enum list like this: enum myEnum : int { This = 2, That, NewVal = 10, LastItm
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)
10
by: kar1107 | last post by:
Hi all, Can the compiler chose the type of an enum to be signed or unsigned int? I thought it must be int; looks like it changes based on the assigned values. Below if I don't initialize...
8
by: tony | last post by:
Hello! I have below a for loop and a switch in the for loop. I have also a enum called colBlowStep with some values. I have also an array called m_columnBlowStep with some strings. All items in...
13
by: toton | last post by:
Hi, I have some enum (enumeration ) defined in some namespace, not inside class. How to use the enum constant's in some other namespace without using the whole namespace. To say in little...
3
by: Cmtk Software | last post by:
I'm trying to define an enum which will be used from unmanaged c++, C++/CLI managed c++ and from C#. I defined the following enum in a VS dll project set to be compiled with the /clr switch: ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.