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]
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.
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
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?
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.
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.
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.
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?
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').
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?
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.
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?
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.
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]
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]
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 .
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.
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] .....
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!