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


ADVERTISEMENT

[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

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

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

VB SQL Incorrect Syntax Near '' - In Order To Evaluate An Indexed Property The Property Must Be Qualified And The Arguments Must Be Explicitly Supplied By The User

Jun 6, 2009

I receive a System.Data.SqlClient.SqlException in the following code: Specifically Incorrect syntax near ' In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user. The exception detail in its entirety is shown below the code.

[Code]...

View 5 Replies

Tell If Enum Property Is Null Or Blank?

Mar 8, 2012

'Attributes
For Each attRefID As ObjectId In myBRef.AttributeCollection
Dim myAttRef As AttributeReference = attRefID.GetObject(OpenMode.ForRead)

[Code].....

How do I tell if my Enumerator property hasn't been given a value?

How do I tell if it is blank?

View 4 Replies

Custom Graphic Control Enum Property

Aug 28, 2008

I am creating a custom graphic control and I'm stuck. I have three classes -
Protected Class ControlBase' Handles common properties and onpaintPublic Class ImageControl Inherits ControlBase' handles Image propertiesPublic Class TextControl Inherits ControlBase' handles Graphic Text properties
I also have a private enum ControlType and Public property for that enum. My goal is to have either a TextControl or a ImageControl created based on the ControlType. Since this property is outside of those two classes and the base - where do I put this property and how do I call up the correct class?

View 1 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

C# - App.config Syntax For Structure?

Nov 6, 2009

I have difficulties figuring out a useful app.config structures for my program.What I am doing is writing a windows service, which watches several directories on a server for files being uploaded.My problem is making my program configurable for n folders when in each of those n folders, i need to watch for a different collection of filetypes

e.g. folder1: .dwg;
folder2: .dwg;.doc;.xls;

then when a new file is uploaded, for example a .dwg file to folder1,then i need to run program1 to convert the dwg to a dwf, and program2 to convert the dwg to a .swf.but that only if filetype is .dwg and folder = folder1. if a .dwg is uploaded for example to folder2, then it needs to be converted to a pdf.The closes i have come to make this configurable in a app.config file is this:

<Folder2 name="C:inetpubwwwrootCAFMFotos" filetypes=".dwg;.pdf;">
<action>
<add key="ExecutableAndPath" value="C:UsersMeDesktopverydocdwg2vec.exe"/>[code].........

I have difficulties bringing this to a usable from in app.config

View 1 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

Stored Procedure Syntax Structure?

Apr 23, 2009

I have a dataset with a bunch of tables in it. I also have a database with the same tables, but not necessarily the same number of rows. Any table in the dataset will have the same rows as there are in the equivalent table in the database, but there may be a few extra in the dataset. What I'm looking for is a fast way to determine whether there are extra rows, and if so, they need to be inserted into the DB.

View 2 Replies

Asp.net - Stored Procedure Syntax Structure - Catch The Output @messase In Label

Jan 8, 2012

This is my stored procedure

[Code]...

View 1 Replies

.net - Property Modifiers Structure

Mar 30, 2012

I have classes structured like this:

[code....]

Is there a modifier I can use on property X in class D which will cause X to be returned as B from an instance of D and A from an instance of D that is evaluated as C?

[code...]

View 1 Replies

Use An ArrayList As A Property In A Structure?

Mar 26, 2010

I was wondering if I can use an ArrayList inside a structure as one of the structure's properties.Or it may be better to replace the structure with a class. If so, can I use an ArrayList as a property of the class.So what I want to do is have the ArrayList as the property of the structure and be able to add items to the ArrayList and clear the ArrayList from a clear method of the structure.

i.e.,
structure.ArrayList.Add (item)
structure.Clear

[code].....

View 7 Replies

How To Make Distinction Between Property Name And Structure Name

Aug 13, 2009

Is there a way to tell VB.Net to use a type instead of a local property name when there is a naming conflict in your code?

Public Class MyClass
private mBedrag as single
Public Property bedrag() As Single
Get

[Code]...

View 3 Replies

VS 2008 Update Structure In .tag Property?

Mar 29, 2010

I am creating labels at runtime. Inside the .tag property I have a structure. Everytime I attempt to update the structure the .tag property doesn't update.

Here is the structure:

Public Structure structChip
Dim kingStatus As Boolean
Dim currentTileLoc As Integer

[Code]....

View 15 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

C# Equivalent Of VB Syntax For Property?

Sep 10, 2009

I found the following syntax as a VB.NET property and I'm trying to convert it to c#, but I'm not sure how to accomplish that.

[code]...

View 5 Replies

.net - Modifiy Item Property In List(of Structure)?

Jan 7, 2012

In a list(of structure), i constantly have to modifiy the property of items using this code

Private Sub ChangeState(ByVal ww As WebWorker, _
ByVal NewState As WorkerState)
Dim oWBB As WebWorker = ListWebWorkers.Find(Function(item As WebWorker) item.Browser.Name.ToLower = [code].....

But this give problem when two or more of the items call this sub procedure. in that one item may already have been removed. This code is executed in the ui thread, and has to be.so is there a better way to modify the items in list structure?

View 2 Replies

Structure Cannot Be Indexed Because It Has No Default Property (WITH CLAUSE)

Nov 29, 2011

Am getting: "Structure cannot be indexed because it has no default property". What am I doing wrong?

With grid.Rows(10).Cells
Dim note As New Note With {.ID = "Blah", _
.Date = "1/1/2011", _
.Message = "AAA", _

[code]....

View 2 Replies

IDE :: Binding Via Property Element Syntax?

Dec 20, 2009

First, I am making the assumption that anything you can do in "Attribute Syntax" (AS), you can do in "Property Element Syntax" (PES), but not vice-versa. That is the reason I intend on coding completely in PES if possible. I have encountered quirks though.The first issue is regarding AS "x:Name" or PES "<FrameworkElement.Name>": If I use PES, I must make sure it is the last element, otherwise any PES below it will error on build; eg "Value of type 'System.Windows.ResourceDictionary' cannot be converted to 'Namespace.ClassName'."

A problem encountered intermixing AS and PES: Set "x:Name" and "MinWidth" as AS. Set "Title" as PES.

[Code]...

View 1 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

Syntax To Change The Value Of A Cached Object Property?

Jun 6, 2010

In an ASP.NET 3.5 VB web app, I successfully manage to cache an object containing several personal details such as name, address, etc. One of the items is CreditNum which I'd like to change in the cache on the fly. Is there a way to access this directly in the cache or do I have to destroy and rebuild the whole object just to change the value of objMemberDetails.CreditNum?The cache is set using:

Public Shared Sub CacheSet(ByVal key As String, ByVal value As Object)
Dim userID As String = HttpContext.Current.User.Identity.Name
HttpContext.Current.Cache(key & "_" & userID) = value
End Sub

View 1 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

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







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