Enums - .NET Enumeration Representation?

Apr 16, 2010

Is it guaranteed that the numeric values for an Enum with only uninitialized values start at zero and increment by one in the order defined?

View 2 Replies


ADVERTISEMENT

IDE :: IntelliSense Doesn't Display Certain Enumeration Values In A .NET Project If Enumeration Is Declared Within A C# Assembly

May 28, 2010

I have just received an interesting feedback from a VB.NET customer using our product - for some reason intellisense hidden a certain enumeration value.After a small testing I have found that this is likely a bug in IntelliSense: [URL]..To be honest, I did not expect this problem with such a basic stuff like this. Have you seen this in the past? For me, it doesn't work in all VS versions...

Anyway, feel free to track this issue if you are coding in VB.NET.

View 1 Replies

Enums Error In Vb, How Is It Different From Enums In C#

Aug 3, 2011

I thought that enums in VB and C# where the same or at least very similar. Then today I stumbled across a bug in our VB code. The following VB code compiles and runs with no issues:

Enum Cars
Subaru
Volvo
End Enum

[code]....

Why does the VB version not catch the type mismatch? Are enum in VB and C# different?

View 2 Replies

An Object Representation Of System ?

Nov 6, 2009

is there an object representation of System that i can Extend upon such that the extended method becomes global.

<Runtime.CompilerServices.Extension()> Public sub globalprocedure(ByVal asystem As ?)

View 3 Replies

C# - Stackoverflow .net Language Representation?

Jun 27, 2012

[URL]notice that the tag topic count for C# is in excess of 8900 while the vb.net tag topic count is sitting at 1019. Does this mean that there is a shift towards c# as a .net language of choice. the only reason I decided to build some applications for work using c# was that I like curly braces - after all vb has the same language support as c#, doesn't it so there should be no advantage to choosing one over the other; other than curly braces;)

View 7 Replies

Graphical Representation Of Data?

Aug 15, 2009

I am totally new to the graphical representation of the data. I want to make a progress report of students, based on marks achieved each year.For example, in year 2005 marks were 750. in 2006 780 in 2007 800

View 15 Replies

C# - How To Avoid Using Enums

Feb 15, 2010

Until asking a question on here I never considered (enums) to be a "bad thing." For those out there that consider them not to be best practice, what are some approachs/patterns for avoiding their use in code?

Edit:

public Enum SomeStatus
Approved = 1
Denied = 2
Pending =3
end Enum

View 5 Replies

Differences Between Enums In C#?

Jan 14, 2010

We have legacy character codes that we want to store as numbers in a new system. To increase readibility and general understanding in the code for devs making the migration, I want to do Enums like this..

[Code]...

With this setup, the code will be readable (imagine If Record.Status = Status.Open), and yet the values will be stored in the database as small numbers so it will be efficient. However... I am a VB.NET guy, but everybody wants to code in C#, so I need this sort of structure in C#.After Googling, I discovered the the general .NET equivalent of AscW is Convert.ToInt32("C"). When I try to use that statement in an enum, I get the compiler error "Constant Expression Required".

View 2 Replies

Enums Via Markup In .NET?

Oct 4, 2011

I have an enum and a usercontrol, both in the same assembly (a plain .NET 4 web site). In the Constants class:public Enum CrudOperations Add Edit Delete. This controls the columns in a GridView on a UserControl via a property on the UserControl

[Code]...

In C#, I've specified the columns to show with markup as Mode="Edit,Delete", but in VB.NET, this does nothing. The only way I can get anything to show is with the codebehind, but if on the containing page I use userGrid.Mode = CrudOperations.Edit And CrudOperations.Delete, I get all the columns (there's also a delete column), but userGrid.Mode = CrudOperations.Edit Or CrudOperations.Delete shows nothing.

View 1 Replies

Using Enums With INotifyPropertyChanged?

Mar 10, 2011

I have a public property, "Status" that is an enum. I have a setter method that changes the status and raises the PropertyChanged event. However, the WinForms user interface is not properly updating. I'm pretty sure it's because Status is an enum. Although I was thinking enum was a reference type but I guess it's a value type. Does INotifyPropertyChanged work the same with reference and value types?

[Code]...

View 3 Replies

Converting String To Its Single Representation?

Feb 15, 2010

I am trying to convert a string to a single. Ive tried csng() directcast() and single.parse. The first two methods crash. Single.parse says input string was in incorrect format. The number is 777.7932 so should convert fine. Ive tried it this way:

'x = single.parse(pts(0), globalization.NumberStyles.AllowDecimalPoint)

how can i convert a string representation of a single data type that is read from a text file into its single data type. I checked control panel and globalization settings are set to english.

View 6 Replies

Decoding File To Graphical Representation?

Aug 2, 2011

I have a file from the client which is a text file. I have to decode the file to a graphical representation. Is there any way I can do it?

View 16 Replies

Graphical Representation Of Array Sorting ?

Dec 30, 2009

I want program to do Graphical Representation of array Sorting in vb.net with bars/shapes.

View 1 Replies

'Enums.NoticeType' Is Not Defined

Nov 25, 2008

I work for a web hosting company and was handed a VB script which I apparently have to compile with some updated settings by 1 of our clients who knows less about it than I do. But when trying to compile the code I receive an error "'Enums.NoticeType' is not defined". As expected I haven't a clue. Am I missing some of the code, or do I have to add some libraries in my Visual Basic 2008 Express Edition? I have pasted the line of code below. If requested I can provide the whole script.

Code:
Public Function UpdateNotices(ByVal intNoticeID As Integer,
ByVal strNoticeTitle As String, ByVal dtDateFrom As Date, ByVal dtDateTo
As Date, ByVal intTypeID As Enums.NoticeType, ByVal boolPrimaryItem As
Boolean, ByVal boolActive As Boolean) As Int32

View 1 Replies

.net - Using VB Interfaces, Enums, Etc In C# Code?

Oct 20, 2011

I have a solution with multiple projects, some of the projects are written in VB, some in C#. I am wondering if there's a way to use interfaces and/or enums written in VB in C# classes? My C# code below doesn't compile, however I am able to see the interface in intellisense.

[Code]...

P.S It's a console/service application, not ASP.Net (where I know it's doable).UPD: Sorry guys, was missing a reference to the project with the interface. It's fixed now. I think the thing that in VB projects references are done slightly different than in C# confused me.

View 2 Replies

Asp.net - Overloading Enums And Properties In .NET?

Sep 23, 2010

I have a base class with the the following enum and property:

[Code]...

First off, how do I do this - is it by simply overloading it? And secondly will my original property pick up the new enum automatically when using the derived class or will I need to overload that too?

View 2 Replies

C# - Iterate All Public Enums?

Nov 22, 2010

We have a common component in our source which contains all the enums (approx 300!) for a very large application.Is there any way, using either C# or VB.NET, to iterate through all of them in order to perform an action on each one?

How to iterate all "public string" properties in a .net class is almost relevant but the enums I am dealing with are a mix of types.

View 5 Replies

C# - Use Flag-based .NET Enums From Lua?

Feb 16, 2012

I'm using LuaInterface for .NET to create Windows Forms objects. This works pretty good except for one thing:I want to use the Anchor property of Control to make them resize automatically. If I only set one of the Anchors (e.g. only AnchorStyles.Top), it works, but this doesn't really make sense. I have to set more than one Anchor, which is done by combining them with "bit-wise or" (or by just adding them numerically).

In VB.Net both works:
Dim myLabel As New Label()
myLabel.Anchor = AnchorStyles.Top[code]....

which is in a sense correct as "LuaInterface treats enumeration values as fields of the corresponding enumeration typ" (says LuaInterface: Scripting the .NET CLR with Lua).It is also not possible to assign the value as a number:

myLabel.Anchor = 15 -- 15 = 8 + 4 + 2 + 1 = Top+Left+Right+Bottom

This time, the error message is rather unspecific:

LuaInterface.LuaException: function

Is there a possibility to typecast the number to the correct enumeration type in Lua?

View 1 Replies

Defining C# Enums With Descriptions

Jan 27, 2010

What would the folowing VB.NET enum definition look like in C#? [code]

View 7 Replies

Using Enums In Project Settings?

Mar 10, 2009

I want to add a setting that uses an enum defined in form1.vb. All the research I've done suggests support for enum type settings is built-in and handled automatically by the VS IDE ... I assume this means it's as easy as defining font or color settings. However, I'm not having much. Are any of you gurus aware of how to set up an enum setting via the Project Settings UI?

View 8 Replies

VS 2008 Get Assigned Enums With OR?

Jul 22, 2010

I realize this is probably trivial, but for some reason I'm not sure how to pull it off. Say I have the following enum:

Public Enum FlagType
Docs
Email

[Code]....

How do I then at runtime determine which flags where set for flags? In this example, it should be Docs and Email.

View 19 Replies

VS 2010 : Using Strings In Enums?

Jan 9, 2012

Is there a way to use strings in Enums like the example below:

Enum myEnum
val1 = "some string 1"
val2 = "some string 2"
val3 = "some string etc"
End Enum

It seems like you can only use integers for the underlying values.

View 13 Replies

Casting An Integer To A Single, Preserving Bit Representation?

Jun 24, 2011

Is there a fast way in VB.NET to take a 32-bit int and cast to a 32-bit float while preserving the underlying bit structure? BitConverter will do this, but I'd like to cast it directly without involving byte arrays.

View 1 Replies

Determine Local Representation Of A Specific GMT Datetime?

Nov 12, 2010

I want to get the date value for

Nov 1, 2010 00:00:00 GMT

expressed in my local time.What is the best way? Currently, I am doing this:

Dim NovGmt As Date = New Date(2010, 11, 1, 0, 0, 0)
Dim Nov1AsLocal As Date = GetGmtExpressedAsLocal(NovGmt)
Private Function GetGmtExpressedAsLocal(ByVal gmtDate As Date) As Date

[code].....

tell me difference between the Date and DateTime datatypes? Is DateTime newer than Date or is it just a synonym for Date? If the latter, why have both?

View 1 Replies

Handling Integer Representation Of True And False

Aug 6, 2009

While testing some code i found something strange how vb.net (2005) is handling integer representation of true and false (or yes and no). Or at least i dont understand the reason for this.Im used to C or Java where 0 is false and everything else is true. To get to the point, here is the code: [code] And the out put is:X: 1 Y: 2x is truey is truex and y is false.If x and y or both individually true, why does it return false when you evaluate x And y.However, change the values of x and y to 4 and 5 you get this:X: 4 Y: 5x is truey is truex and y is trueJust another example, which seems to work how it should to me:X: 4 Y: 0x is truey is falsex and y is false.

View 7 Replies

Hashtable - Get String Representation Of Object Reference

Jun 3, 2011

I want to make a hashtable of object references and I want a different object's reference to be the key. How can I do this in vb.net? In java (assuming I am using the default toString method and that add() takes a string as a key and an object ref as the value) this would be something like: hashtable.add(obj1.toString(), obj2)

I do not want to use a vb.net gethashcode() function because I want deep clones of objects to have different identifiers. A related question is what is the default toString in vb.net? How can I get a string that represents an object reference in vb.net?

View 3 Replies

Multiplying The String Representation Of REAL Numbers?

Jan 12, 2012

<edit> Now showing the difference as a DECIMAL. Result looks like zero every time. </edit>Disclaimer: This code is provided "as-is" and should be treated as Freeware.( However any donations would be welcome as I have a "so-so" part-time job ).Please note all real numbers to be used should be in this format
"0.000000000000"Do not use numbers in string format in scientific notation like "1.2345E -06"I was feeling bored and decided to add to the code from JohnWein in this thread where I have used a routine that will multiply the contents of two long strings together.>>[url]I have now added a bit of code so you can multiply two really long numbers with or without a decimal point as a full-stop ( period or dot, call it what you like ).

[code]...

View 5 Replies

VB 2008 Replacing Characters With No Visual Representation?

Jun 22, 2012

my OCR copy text to a TextBox with “” at end, “” acts like enter key. Is it possible to replace it to something or remove it? For example, I want to copy number “1000” to my text box with OCR but I get “1000”(it’s a little different boxes, I couldn’t copy exact ones here). And I can’t do

TextBox2.Text = TextBox2.Text.Replace("", "")
, because  is an "enter key" and what I get looks like that:

View 10 Replies

VS 2008 Convert Binary Representation To Integer

Apr 6, 2010

I am using this to convert a number to binary representation:

[Code]...

View 1 Replies

Direct Access To Full String Representation Of Object

Jan 23, 2012

I am trying to log the contents of an object to a text file. If I do a debug.print of the object itself in the immediate window, it prints all of the values of the object's properties:

?mDb.DatabaseOptions
{Microsoft.SqlServer.Management.Smo.DatabaseOptions}
AnsiNullDefault: False
...
UserData: Nothing


However, I can't seem to access this as a string in code due to a type mismatch. I assumed I could get this information using the .ToString method, but all that returns is the object description with none of the properties or values:

?mDb.DatabaseOptions.ToString
"Microsoft.SqlServer.Management.Smo.DatabaseOptions"

View 2 Replies







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