473,386 Members | 1,821 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.

Defining an Enum within a Structure...


I got things working until I tried adding this
enum to a structure...

Public Enum Keyboard
EnglishUS
EnglishUK
Spanish
German
Italian
French
End Enum

Public Structure TUserStats
Public language As Keyboard <----------
Public User As String
Public BestPercentage As String
Public BestCompleted As Integer
Public BestAverage As Single
End Structure

The arrow above points to the problem. I'm stopped at
this line below:
FileGet(1, Globals.RecStats)

An error window pops up and says....
"An unhandled exception of type 'System.ArgumentException'
occurred in microsoft.visualbasic.dll"
"Additional information: Object type cannot be converted
to target type."

'..
Nov 20 '05 #1
4 1762
"imme929" <im*****@nosuchplace.net> schrieb
The arrow above points to the problem. I'm stopped at
this line below:
FileGet(1, Globals.RecStats)


Why do you think the problem is now related to the Enum within the
Structure? I don't think this is a problem. Please stay in the other thread
dealing with the same problem.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Hi,

Why dont you use a class instead. Here is a simple example.
http://www.onteorasoftware.com/downl...alizeclass.zip

Ken
-------------------
"imme929" <im*****@nosuchplace.net> wrote in message
news:SL*************@newssvr15.news.prodigy.com...

I got things working until I tried adding this
enum to a structure...

Public Enum Keyboard
EnglishUS
EnglishUK
Spanish
German
Italian
French
End Enum

Public Structure TUserStats
Public language As Keyboard <----------
Public User As String
Public BestPercentage As String
Public BestCompleted As Integer
Public BestAverage As Single
End Structure

The arrow above points to the problem. I'm stopped at
this line below:
FileGet(1, Globals.RecStats)

An error window pops up and says....
"An unhandled exception of type 'System.ArgumentException'
occurred in microsoft.visualbasic.dll"
"Additional information: Object type cannot be converted
to target type."

'..

Nov 20 '05 #3
Ken Tucker [MVP] wrote:
Hi,

Why dont you use a class instead. Here is a simple example.
http://www.onteorasoftware.com/downl...alizeclass.zip


The example works, but when I transfer to my
program I get this error message and it stops
at the line: bf.Serialize(fs, t)

"An unhandled exception of type
'System.Runtime.Serialization.SerializationExcepti on' occurred in
mscorlib.dll

Additional information: The type letterchase6.Globals+TUserStats in
Assembly letterchase6, Version=1.0.1576.35765, Culture=neutral,
PublicKeyToken=null is not marked as serializable."

Nov 20 '05 #4
imme929 wrote:
Ken Tucker [MVP] wrote:


Never mind, it's working.
Nov 20 '05 #5

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

Similar topics

3
by: Obrecht | last post by:
Hi. I am new to VB .NET and am just starting to do some testing with it. I am trying to define a fixed length array of structures within a structure. I pass this structure to a Win32 Btrieve...
6
by: Michael Isaacs | last post by:
Regarding use of enum's, I am wondering what the cost of memory is when creating the enumeration on the calling side, and then using it on the function/method side. See example below. If I...
2
by: Alex Feldman | last post by:
Which of the following is better? Defining an enum type inside a class as a nested type, or in the the namespace? An example of nested type enumerated type would be: public Class Product...
11
by: | last post by:
Is it possible to define a variable in a block in order to make it invisible outside that block? For example, in C I can write { int a .... } then a will only be available inside the curley...
10
by: Michael Feld | last post by:
Hello, does anyone know how to produce a data type which offers Enum-like IntelliSense in VS 2005? What I am trying to create is a type which is very similar to an enum, i.e. has a fixed set of...
6
by: Brett Romero | last post by:
I'd like to create one enum that holds webpage name values and corresponding URL values. For example: enum webPageFileName {index = "index.aspx"} enum webPageName {index = "index"} enum...
10
by: nambissan.nisha | last post by:
I am facing this problem.... I have to define a structure at runtime as the user specifies... The user will tell the number of fields,the actual fields...(maybe basic or array types or...
1
by: Joe HM | last post by:
Hello - I have two Enums for which I would like to define type conversions ... Public Enum eA A2 = 0 A2 = 1 End Enum Public Enum eB B1 = 2
6
by: sethukr | last post by:
can we define enum within a structure?? for example, typedef enum {red,blue}color; struct s1{ color c; }obj;
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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,...
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...

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.