Added An Attribute For A User Readable Display Name To Enum Values
Mar 10, 2011
I've added an attribute for a user readable display name to my Enum values.However my code to convert from the user readable display name back to the Enum (function ToEnum) seems very convoluted.I am wondering if I am missing a better way of doing this (I am using Visual Studio 2010 with SP1.) [code]
View 10 Replies
ADVERTISEMENT
Jun 19, 2012
I've searched until my eyes and fingers feel as if they are going to bleed. I cannot come up with the answers I'm looking for. I want to essentially create an inventory system without using a database (part of why the eyes are bleeding, keep getting directed on side tangents), that is fed by the user. IE, User enters a name of a product, it is added in to an array. As a designer I will not know the exact number of elements to be held within the array. The user will enter their chosen item in to a text box. So I'm looking for a way to take the value in the text box and add it to the array. I believe I would use the reDIM function to do this, but beyond that I've got nothing. I'm unsure of how to reference the value stored in a text box.
View 7 Replies
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
Mar 22, 2009
I have a list view with 2 columns (Prodduct and Price). I want the user to be able to add there own values to the listview and have them save so that they will always stay there.I would also like users to be able to delete specific items from the saved list.
The values added to the colums are paired, and must stay together, as one value would be a product and the other a price, So they must, stay together. as a pair
View 6 Replies
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
Sep 7, 2010
i came up to create my own because i need to encrypt 10character string and i want it to output also 10character string..security is not my concerned here..what i want is encrypted string is not readable by the user or is not obvious to user.. is this possible by the use of Xor method?..BTW,its better if the output is alphanumeric.
View 3 Replies
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
Jan 2, 2009
cast integer values to an array of enum values?
View 2 Replies
Feb 21, 2009
I'm trying to create a for loop that will display the values (favorite programming languages) a user selects for a listbox.
So far I have this:
Dim selectedLanguages As String = ""
For intLoopIndex As Integer = 0 To languageListBox.Items.Count - 1
[code]....
So far, no matter how many items they select it will display a comma even if only one item is selected, example "C#,"However this is what I need it to do:
1. If the user selects one programming language than it should just printout the selected course with a period right after it. Example: C#.
2. If the user selects two languages it needs to have the text "and" between them followed by a period. Example: VisualBasic.Net and C#.
3. If the user selects three or more languages it needs to seperate them like this for example (again with a period at the end): VisualBasic.Net, C#, and Asp.net.
View 2 Replies
Mar 24, 2011
In this post Jon Skeet pointed out that the following code should be changed to conform with the .NET naming conventions. Doing that would also decrease the amount of noise in the code.
[Code]...
I must admit, I was pretty much like a sheep and was following what others have done before me. I thought the prefix did not look right and then to have it twice did not make sense either. After looking at a couple of .NET Framework examples, it looks like this would be closer to the standard.
[Code]...
View 3 Replies
Nov 21, 2011
I don't know how to convert the following line from VB to C#:
Dim values As New List(Of T)(System.Enum.GetValues(GetType(T)))
My version doesn't work:
List<T> values = new List<T>(System.Enum.GetValues(typeof(T)));
The best overloaded method match for 'System.Collections.Generic.List.List(System.Collections.Generic.IEnumerable)'
has some invalid arguments
The constructor-parameter doesn't take it that way - what cast (or else) am I missing?
For clarification: It is wrapped up within the following generic method
public static void BindToEnum<T>()
{
List<T> values = new List<T>(System.Enum.GetValues(typeof(T)));
//...
}
View 2 Replies
Jul 5, 2009
I have the following code which obtains the compass direction from a degree value. I'm new to VB.Net and was wondering what is the best way to store the values, in an Enum or an Array?
[Code]...
View 7 Replies
Sep 19, 2010
In VS2008, you could write, for instance,
dim enumValue as MyEnum
enumValue =
And then as soon as you typed the =, you'd get a list of possible values of MyEnum. With VS2010, you have to type
dim enumValue as MyEnum
enumValue = MyEnum.
Before getting the list on typing the final. This makes for a lot more typing and seems to be a retrograde step ... is there an option I'm missing? (I have 'Auto List members checked in the Text Editor options under 'Basic').
View 1 Replies
Jul 20, 2009
I have a enum,
[Code]...
I need put the "text" value of all the above Enum values in to a combo box, how do i do it?
View 4 Replies
Jan 4, 2010
Neat way of running across all the values of Enum?
i was looking for a way without have to use methods residing in [Enum]
View 2 Replies
May 23, 2009
I'm struggling with enums
Private Enum sizeMode
AutoSize = 2
CenterImage = 3
Normal = 0
[CODE]...
Here i'm trying to cast a string to a pictureboxsizemode: PictureBox1.SizeMode = DirectCast(DirectCast(fields(4), sizeMode), PictureBoxSizeMode)
View 2 Replies
Sep 1, 2010
get Intellisense in Visual Studio 2005 to display the meaning of individual enum values for a VB.NET project. This already happens for enums that are a part of the .NET library?
View 2 Replies
Jan 31, 2012
I am working on asp.net application. I have a function like this:
Public Function ExtractText(node As XmlNode) As String
End Function
I need to pass following XML as input to above function:
<myrequirements Id="7743" Type="tcg_Concept20_sc_323256419566173_context" StartNode="2724" EndNode="2869">
</myrequirements>
Then I need to get StartNode and EndNode attributes values.
View 1 Replies
Apr 15, 2011
Newbie looking for help on getting xml http response in vb.net this is what im looking to do ,getting these attributes values(Red,Green,Yellow,Black) to a 4 different textbox's on vb.net project.
[Code]...
View 1 Replies
Aug 10, 2010
i was wondering if we could assign variables into the values of attribute properties like say:
<System.Xml.Serialization.XmlType(namespace:="Result" + x)>
where x is a string with value "qwe" so basically we get the output:
<System.Xml.Serialization.XmlType(namespace:="Resultqwe")
View 4 Replies
Dec 22, 2010
I wonder, what is the most elegant way of dealing with the dbnull situation. I have a class, with attribute, let's say: "End_Date", which is being read from database. Type of this variant should be date, but as it's the "End_Date", there might be the situation that something haven't ended yet, and in the database in this field I have a null value.
Right now a deal with the problem this way:
Dim mEnd_Date
...
Public Property End_Date ()
Get
End_Date = mEnd_Date
End Get
Set(ByVal value)
mEnd_Date = value
End Set
End Property
But I am not sure if that's a good way as I don't declare variants as any datatype?
View 5 Replies
Dec 2, 2010
How to add my explanation to auto finish in user classes or enum etc?
View 3 Replies
Feb 8, 2012
I'm working on upgrading a solution in VB.NET that is heavily based on Active Directory. As of now, I'm trying to add a PC restriction to a new AD User upon user creation. Essentially, I need to update the Logon To attribute to include 1 or more PCs, how do I go about doing this? I learned that I am interested in the IADsUser property "LoginWorkstations" url...). As of now, I have code that can fetch this attribute from any AD user, but I cannot set it. [code]I've tried testing this approach with a different attribute and it works just fine. Not much out there on Google either unfortunately.
View 2 Replies
Jun 21, 2010
I have valued pairs, attributes names and values in one hand, and I have an object with attributes. I need to set the values of those attributes. I need something like [code]
View 1 Replies
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
Jan 23, 2010
I am using ASP.NET MVC to build a site. I am using VB as programming language.I have couple of questions.
1 I have created a role "Manager". How Do I check if a user belongs to this particular role?
For now I am using If My.User.IsInRole("Manager") Then 'Direct to a view Else 'Direct to another view End If Is this the right way? 2 How to use the Authorize attribute to limit access to a Function?
I know in C# it goes [Authorize (Roles ="Manager")] but not sure in VB. Also can I define property to redirect a user who does not have "Manager" role to a particular view when trying to access this function .
View 1 Replies
Apr 2, 2009
So - I have some text in an RTF control. I want the user to be able to highlight text and apply an attribute. The following code is placed into a button called BOLD and seems to work nicely:
If rtfText.SelectedText.Length > 0 Then
rtfText.SelectionFont = New Font(rtfText.SelectionFont, FontStyle.Bold)
End If
The code above will turn the selected text bold.
But then the user selects the Same text and with the following code placed into a button called ITALIC it removes the bold attribute and replaces it with italics.
If rtfText.SelectedText.Length > 0 Then
rtfText.SelectionFont = New Font(rtfText.SelectionFont, FontStyle.Italic)
End If
Since the users actions are separate - I can not know that they want BOLD and ITALIC, so how do I make sure I keep the existing attribute on the selected text (which, by the way could be part bold and part not-bold) and add italic?
Somehow I need to add the italic attribute to the selected text, not simply replace all attributes with italic.
View 1 Replies
Nov 19, 2010
I need to get values of each textbox in loop with different names, I have three row (name,telephone,email) and off course three textbox, how to get in loop, I need to insert them in database. The main problem is that values are getting one by one in loop where I get textbox in for each loop. I need to insert multiple columns in database with just single insert query
Here is the code
Dim arr() As String
Dim record As Int32
record = 0
For Each div As System.Web.UI.Control In plholder.Controls
If div.[GetType]().Name = "HtmlGenericControl" Then
[Code] .....
View 1 Replies
May 31, 2012
I'm struggling to return user details from AD using LDAP, after i have authenticated that the user exists. I am using a simple auth method as follows:
Function AuthenticateUser(path As String, user As String, pass As String) As Boolean
Dim de As New DirectoryEntry(path, user, pass, AuthenticationTypes.Secure)
Try
Dim ds As DirectorySearcher = New DirectorySearcher(de)
Dim result As SearchResult = ds.FindOne()
[Code]...
the problem is that "distinguishedName" returns "DC=our-domain,DC=co,DC=uk" and "name" returns just "our-domain", not the name of the user that has just been auth'ed
Note: the displayName.text outputs are purely for debug purposes.I have tried various combos of requests but nothing seems to return USER details. ETA: to the security police: this is all within a https connection, I'm not sending passwords about in plain text!
View 1 Replies
Dec 4, 2010
Using the following code..
Try
sing MemStream As New IO.MemoryStream
[code]......
View 1 Replies