[2008] Enum In Structure

Feb 4, 2009

I am coding in vb.net. I want to achieve something like this (sample) -

Structure Transport

Dim land as L
Dim Air as A

[CODE]...

But though i can create enum but how can I embedd it in structure. It is not allowing me to do that.

View 2 Replies


ADVERTISEMENT

Add An Enum To An Existing .NET Structure, Like Date?

Feb 23, 2011

What I am wondering is, is it possible to create an enum and attach it to the DateTime structure? Extension Methods come instantly to mind, but I don't know of a way to pull this off using them.

Dim july As DateTime.Months = DateTime.Months.July
Public Enum Months
January = 1

[code]....

View 3 Replies

Add An Enum To An Existing NET Structure Like Date?

Oct 26, 2011

So apparently Microsoft does not have a Months Enum on their Date structure.What I am wondering is, is it possible to create an enum and attach it to the DateTime structure? Extension Methods come instantly to mind, but I don't know of a way to pull this off using them.[code]...

View 3 Replies

Use Structure, Property Or Enum Syntax?

Nov 10, 2011

I think it's substituable for just Dim, Public or others. What is merit by using structure, property ??

View 1 Replies

Enum Inside Structure - Adding Properties?

May 19, 2009

I have an enum that I want to give some methods. I thought about changing the enum to a structure so I could add properties, but then the enum is a value inside the structure (not the structure itself), so this would affect comparisons and such. (For example, instead of writing
EnumVariable=EnumConstant,
Now it is
StructureVariable.EnumValue=EnumConstant).
At least, this is my understanding of it. It seems awkward to have to do this for such a simple scenario, so is it possible give enums properties, yet still have them treated as before? I've thought maybe I need to create a new valuetype from scratch, but I've never done that before.

View 7 Replies

Create A Enum Or Enum Type Functionality Witch Return String (enum Returns Int) In .net

Dec 30, 2009

I have a URL lets say . some time i need to send HTTP and some time i need to send it to HTTPS for that i created a enum:

Private _protocol As Protocol

Enum Protocol
HTTP
HTTPS

[CODE]...

Now when i get value back from protocoltype it returns me integer value as enum do so tell me how to get string from enum or other substitute.

Dim targetUri As String = setting.protocolType & "://www.mysite.com"

View 1 Replies

Enum Item - Protected Name - Statement Cannot Appear Within An Enum Body

Mar 25, 2011

I'm trying to declare an enumeration and one of the names I'd like to use for an item is not usable apparently. Where I am declaring 'STEP = 3', I get this error message in visual studio: "Statement cannot appear within an Enum body. End of statement expected." Is it possible to use STEP as an item name somehow? [Code]

View 4 Replies

VS 2008 Convert The XML Structure Into A Class Structure?

Apr 25, 2010

I'm having a problem that's driving me crazy; I can't understand how to convert the XML structure into a class structure (that I want to use to hydrate a XML document).

The XML document looks like this:

xml
<?xml version="1.0" encoding="utf-8"?>
<artists xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.spotify.com/ns/music/1">

[code]....

View 2 Replies

ENum Names And Values Don't Match For Same ENum

Jan 2, 2012

RE - FilesystemRights Enum

This Code:

Dim FSRS As Type = GetType(FileSystemRights)
For Each fsr As String In [Enum].GetNames(FSRS)
TextBox1.AppendText(fsr.ToString & vbCrLf)
Next

View 3 Replies

Nullable Enum Verse Enum.None?

May 26, 2010

Which is better, using a nullable enum or adding the value None=0 to your enum list?Using nullables requires more code, but I kind of like it since it forces me to think about the possibility. Otherwise I'm liable to forget about the None enum and fail to account for it being a special case.

View 11 Replies

Search An Enum Value Inside Of An Enum?

Aug 23, 2011

I've tried the code below but it always returns nothing, It should enter

Protected Function GetTotalDebitAmount(ByRef roEntryDetailRecordBaseList As List(Of PPDEntryDetailRecord)) As String
Dim iTotal As Integer = 0

[Code]....

I need some one who evaluate the part below:

If CBool(Array.IndexOf([Enum].GetValues(GetType(TransactionCodes.Debits)), CInt(oEntryDetailRecord.TransactionCode)) > 0) Then

View 1 Replies

VS 2008 PropertyGrid And Dynamic Enum From DB

May 26, 2010

We are using the .NET PropertGrid to edit the Usersettings of our application. If we use Strings or integers than it works perfectly. Now we need a propery, we call them "Vendor", that store a GUID of the Vendor from a database. But the user didn?t see the GUID in the PG. he can choose beetwen the venders Names in a combobox. This combobox must be loaded from the database I have start to try to solve that with following

[Code]....

View 2 Replies

VS 2008 Enum Property Changing Unexpectedly?

Sep 2, 2010

I have an Enum file, as shown in first code block. Though it's first time I use an enum file, so maybe it's not correct to use it like this.. My purpose is just to be able to reference a global parameter from anywhere, so I can just type DataInterval.M1, and it will be treated as an integer... or.. will it not ? urther I have a property in my DataSeries class, of type DataInterval. And in this class I also have a bunch of methods Get/Set etc. to do different work on the dataseries (Inherits List(Of BarData)). roblem: The interval property keeps changing unexpectedly every time the GetNextCloseTime function is called.

''' <summary>
''' "Time Frame" of data series
''' </summary>

[code].....

View 5 Replies

VS 2008 Intellisense Sensitive Comments For Enum?

Mar 28, 2010

I've found the ability to make meaningful Intellisense-enabled comments on my functions and sub routines absolutely priceless.

I'm wondering if I can do the same when an Enum is defined. I'd like for each Enum highlighted in the drop list to have some information associated with it. Can that be done?

View 3 Replies

VS 2008 Using ENUM Definition In Class Properties?

Jul 28, 2011

In a global module, I define a new type that can take 4 values:

enum tAction as integer
None
Update
Insert
Delete
end enum

A use this type in many places in my code to check the value stored in a variable (if MyAction = tAction.Delete then ...)

In a separate file, I define a class. One of the properties should return a value of this type:

public class XXX
private _Action as tAction
public property ClassAction() as tAction

[Code].....

This way I could check a class property in the same manner (if MyClass.ClassAction = tAction.Insert then ...)

However I get a syntax error in the property definition: 'ClassAction' cannot expose type 'Globals.tAction' outside the project through class 'XXX'

My entire program consists in a few modules, in a single project. How can I use my tAction definition in my classes?

View 4 Replies

VS 2008 - Class Ranking List Box Has An Enum Function?

Dec 7, 2010

Application: Arrays are to be used for this. When button Add Student is clicked it should add all the information for a student and when Show Student button is clicked it should prompt the user for student's last name and student's information in a message box. Class ranking list box has an enum function to it and has to be stored be show along side other answers.NOTE: FindItemIndex if from the last application I did, i am suppose to use it in this one,so you can modify it the way you want.

[code]...

View 3 Replies

VS 2008 Making Property In A Class Expose An ENUM?

Jul 12, 2009

I've got this in a public module

Module PublicModule
Public caseBAL_C As caseBAL
Public clientBAL_C As clientBal
Public Enum CSFlags

[Code]...

It doesn't like the Public Property StateFlag() As CSFlags -it's saying that CSFlags

'StateFlag' cannot expose type 'PublicModule.CSFlags' outside the project through class 'caseBAL'.

View 2 Replies

VS 2008 - Retrieve Enum Custom Attribute In Single Statement

Jan 28, 2010

I have an enum set with custom attributes. need to retrieve the attribute value in single statement ...

Public Enum Messages
''' <summary>
''' <value>(MessageText : Do you want to save ?)</value>
''' </summary>
<StringValue("Do you want to save ?")> Save
[Code] .....

Now I needed to retrieve the enum value like something below.
Messages.Save.GetType().GetCustomAttributes...... something is possible in single statement itself?

View 1 Replies

VS 2008 Add Explanation To Auto-finish In User Classes Or Enum Etc?

Dec 2, 2010

How to add my explanation to auto finish in user classes or enum etc?

View 3 Replies

VS 2008 Enum And Radio Boxes-passing Info To Business Class?

Jan 29, 2011

I'm trying to pass data from the main form to a business class form for calculation.I have 3 types of cars and I can't get the code right to pass that to the business form. It seems correct to me, but obviously, it's not.This is the code for the calculate button, I can't figure out why its telling me that CarSize is not a member of the business form when I have it in the Enum statement at the top. I'm going by what the book says and this appears right according to it.

Dim CarTypeInteger As Integer
'determine the car size from radio buttons
If LuxuryRadioButton.Checked Then

[code]....

In the book it says to specify the class name when declaring the enum on the business form. So to me it looks like it should be -RentalRate.CarSize.Luxury The error I have is 'CarSize' is not a member of the 'ChristiansCarRentals.RentalRate'.

View 6 Replies

Structure Inside Another Structure Receives Null Reference Error?

Jan 5, 2012

Module Module1
Public Structure structure1
Public TRANS() As structure2
End Structure
Public Structure structure2
Public X() As Integer
End Structure
End Module

View 17 Replies

Class Structure - Large Structure That Has Lots Of Properties ?

Jan 5, 2010

I'm new to VB 2008 after having spent a long time with VB6, so I apologize if this is a stupid question. But I'd really like to have this straightened out.

Let's say I have a pretty large structure that has lots of properties.

Code:

Now say that I want an internal database with about 10 instances of this structure total, describing, say, 10 different products that a store sells. When these values are loaded from a database, they remain totally static. (However, they can be different each time a program loads)

Now say that I have a class. Each instance of this class is a type of that BaseProduct structure. Meaning, each instance of the class pertains to one of the 10 types of products that the store sells. However, this class has additional properties that pertain specifically to each instance, which are not static.

Code:

Now, the problem here is... If I have 200 different transactions, each one contains an instance of BaseProduct. BaseProduct is HUGE, and is largely redundant (only 10 types possible), so I think it's a little silly to include a whole copy of it with EVERY transaction. However, the Transaction class really needs information regarding the base product it pertains to. Is there a way to, instead of declaring a New BaseProduct in the Transaction class, to simply make one of the properties of the Transaction class a pointer to a BaseProduct variable?

In VB6, I would accomplish this by making a BaseProduct(10) array, and then giving each Transaction an ID number referring to an entry in that array. But in VB 2008, using class structure, this is impossible. I can't define the BaseProduct(10) array outside of a class in a namespace, and if I define it in the actual application's form, then the class loses modularity since it relies on the application that's using it.

View 11 Replies

Converting Structure Within Structure To Byte Array For Socket

Aug 29, 2009

I am trying to communicate with an external device and i am trying to send a byte array to the external device via sockets but i am always getting a response the message size is too small so i am not sure what i have done wrong. Between the data type there should be no alignment present and all numbers are represented in little endian format. The char array is not null terminated as mentioned in the protocol specifications.

I have to send data based on a struct that embeds 2 other struct. So here's my vb.net code for the struct used to convert to byte array and the sending part.

Public Structure MESSAGETYPE_OIP_Login
Dim Header() As COMMANDHEADER
Dim UserName() As PSTRING

[Code]....

View 2 Replies

Invalid Structure Size When Marshalling C Structure To .NET

Apr 14, 2012

I'm experiencing a problem with the following c-structure:

typedef struct tagTEXTUREPROP
{
DWORD dwSize;

[Code].....

The Marshal.SizeOf obviously calculates a size of 76 and it works with the DLL function, but it leaves me with some bad feelings.

View 1 Replies

Creating Structure In 2008?

Apr 3, 2012

how to create a structure in Visual Basic?r example:

Public SCARD_READERSTATE()
Dim szReader As String 'reader name
Dim pvUserData As Long 'user defined data

[code]....

I'm using Microsoft Visual Basic 2008.

View 2 Replies

How To Use Constant In Structure In VB 2008

Aug 8, 2009

I want to know that how we access a constant which is declared in a public structure, with an instance of that structure?

View 7 Replies

VS 2008 DateTime Structure?

Jul 29, 2009

I want to pick specific elements from DateTime and assign them to variables: Year, Month, Day, Hour, Minute, and Second. In MSDN, I saw ways to assign it all, but not what I needed.

Can anyone one give a hint, or two?

View 4 Replies

VS 2008 Some Hint About Structure?

Mar 13, 2010

Im triing to use structures.example

Public Structure Column
Dim ID As Integer
Dim Name String
Dim Birth As Date
End Structure

1) Is possible know how many element are in the structure?

2) is possible retrive the type of the data inside a structure? (Integer, String, Date)

3) is possible scan the element without use their name (by using an index as in the string) instead of use Column.ID=1 ? If the none of the questions are positive, what other stuff should i use that allow me to do that?

View 6 Replies

VS 2008 TreeView Structure

Mar 31, 2011

The General TreeView Structure, with the level indicated in the left.[code...]

Leaving the 0 and 1 levels, the other levels has to be treated as above. How to achieve this?

View 5 Replies

VS 2008 Using ArrayList With Own Structure?

Oct 11, 2009

I'm trying to use my own structure as a dynamic array (ArrayList?) but can't find the right syntax.

Public Structure BLsCompsRootDir
Public BL As String
Public Component As String

[code].....

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved