C# - From A UITypeEditor, Retrieve An Attribute Applied To The Parent Of A Property In .net?
Jan 20, 2010
Consider this scenario:
Class MyClass
Property SubProp1
End Property
[code]....
Next, I put an instance of MyButton into a property grid, expand property MC and edit SubProp2.From the type editor for SubProp2, I want to get hold of the attribute applied to property MC.Looking at the context,PropertyDescriptor.ComponentType, we arrive at Type: MyClass.If i look at the attributes applied to MyClass, though, it will only return the attributes applied directly to MyClass, and not the extra attribute applied to the property MC.
View 2 Replies
ADVERTISEMENT
Mar 26, 2012
I keep on getting errors for every line in the code below that tell me that the attributes cannot be applied multiple times. What does this mean and how can I fix it without changing what the code does?
Imports System.Reflection
Imports System.Runtime.CompilerServices
<Assembly: AssemblyTitle("")>
[Code]....
View 2 Replies
Mar 5, 2009
I have an xml similar to this one[cod]e...
View 5 Replies
Dec 8, 2011
I am using a repeater with the Item Template of a checkbox. Here's my checkbox template:
[Code]...
Now, I know asp checkboxes do not have a value attribute, but I read somewhere that you can put that in there and it will work the same. I'll have to look it up again to see if I read it wrong. However, just in case it is possible to put the custom attribute in there, how do I retrieve it in code behind? I looked at the source after the page is created and there is no attribute in the control that says "value".
View 1 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
Mar 6, 2010
How can I shift the GET-implementation of a Class property to a / using a custom attribute? (I've added instantation vars (classname, propertyname) to the attribute, however I'd rather have these automatically fetched ofcourse.)
Public Class CustomClass
<CustomAttributeClass(ClassName:="CustomClass", PropertyName = "SomeProperty")> _
Public Property SomeProperty() as String
Get() as String
[code]....
View 3 Replies
Aug 4, 2010
i wrote a custom attribute and got the following Color property that I want the user to be able to indicate the color property in the attribute on a class:
Private _ColumnColor As System.Drawing.Color
Public Property ColumnColor() As System.Drawing.Color
Get
[Code]....
View 1 Replies
Jan 18, 2012
[Code]...
Why is the first line not correct? What it wants is a System.Type and a System.String but refuses to work.
View 15 Replies
Dec 20, 2011
I have a class created for use with the PropertyGrid control in a VB.Net application. One of the properties of the class is:
Private _someProp As String
<Browsable(True), _
BindableAttribute(False), _
[code].....
View 1 Replies
Apr 9, 2009
I think know how to do this in C# but I'm having syntax trouble in VB.NET because I need to take advantage of the 'handles' event stuff. I have different events that I somehow (probably delegate) need stored in a property of an attribute (I just add an attribute to a property linking to the corresponding event).
E.g.
<BindEvent(EventThing)>_
Public ReadOnly Property IsTrue() As Boolean
Get
Return True
End Get
End Property
They need to be events so that other programmers can use the VB.NET handles keyword on methods.
Public Delegate Sub TestEvent(ByVal sender As Object, ByVal e As Object)
Public Event E As TestEvent
Public Sub Test() Handles E
End Sub
These properties are already raising a general event, which I am catching, determining the related property and thus getting the related attribute (and delegate/event). I want to then raise the event that's related. If I just use a delegate tied to the particular event that won't raise other handlers will it? I also want to avoid having to write a sub for each property that just uses Raise Event on the event type if possible as this seems redundant.
E.g. avoid:
Public Event E As TestEvent
Public Sub CallE(ByVal sender As Object, ByVal e As Object)
RaiseEvent E(sender, e)
End Sub
[Code] .....
View 2 Replies
Mar 24, 2009
I have done some searching, but am still having trouble trying to set the browsable attribute of property to false at runtime in order to hide in the properties grid control (based on certain conditions).
View 9 Replies
Feb 15, 2010
I have code for a custom DateTimePicker in this thread.>> Do I need to add an attribute to the properties to instantly show changes in design view please
View 8 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
Jul 26, 2010
I successfully retrieve a user (call it userA) from Active Directory that exists in Domain A in the users subdirectory. I then try to remove the user from AD by doing
dim theParent as DirectoryEntry = userA.Parent
theParent.children.Remove(usera)
This fails because when I look at the parent node in a Watch Window in Visual Studio, all of its members say COMInterop.Exception.
View 1 Replies
Dec 29, 2011
I was just wondering if it is possible to apply an attribute to a property within a business object (MyBusinessObject) such that after the DataSource of a grid is set to a List(Of MyBusinessObject), the visible property of the column will automatically be false. For example:
myGrid.DataSource = New List(Of MyBusinessObject)
Public Class MyBusinessObject
[code]....
View 1 Replies
Feb 17, 2010
I have a simple class that I trying to populate from an XML document. The XML file has an attribute called TrackingID in the root node which I would like to get as a property. For some reason, when I deseralize the class, the TrackingID is null. Everything else populates fine. I have tried various attributes on the TrackingID property with no luck.
[Code]...
View 1 Replies
Oct 12, 2009
I have a smart tag up and running for my user control but I also want to add a UITypeEditor collection editor to it as well. If I add the collection property to the smart tag in the usual way then I get the ellipse appearing as expected, then if you click on this you get the Collection Editor pop up but if you click ok in the Collection Editor I keep getting an error:
error using the drop down: unable to cast object of type BarChartControl.BarChartActionList to type BarChartControl.BarChart
In the DesignerActionList class I have the following:
Public Property Bars() As BarChartControl.BarItemCollection
Get
Return _linkedControl.Bars
End Get
[code]....
and in the GetSortedActionItems() of the DesignerActionList class I have:
items.Add(New DesignerActionPropertyItem("Bars", "Bars", "Bars", "Manage bar collection."))
View 2 Replies
Feb 15, 2010
I had a strange problem editing a class in the property grid whereby the property grid would refresh incorrectly.I managed to reduce the problem down to a class with just two properties. I've included the code at the end to ease explanation.It basically boils down to a class with two properties. The first of which is expandable (a font)The class itself is expandable and also implements the CreateInstance method in the type converter.To see the problem, expand the font, edit, say 'Bold', and tab away. Two problems happen:
(1) The second property jumps up and ends up in the expanded font property.
(2) The '-' sign of the expanded font changes to a '+'.
The problem goes away by attaching ResfreshProperties(RefreshProperties.All) to the class. That's great, but I'd like to understand how it fixed the problem. I've had a look in reflector and can't find any examples of RefreshProperties being attached at the class level.
[code]...
View 1 Replies
Feb 21, 2010
I'm trying to make a custom type editor for a generic Brush. The editor form is done, everything works, except the changes don't show up in the xxx.Designer.vb file. I think it's because VS doesn't know how to represent the Brush type. How do I do it?
View 6 Replies
Feb 21, 2010
Is there a way for an object to call the object that contains it, like how a FrameworkElement has a Parent Property?Bill Gates look out!
View 4 Replies
May 14, 2009
I would like to have a form class that is called from a button on a parent form and would like a button on the child form to set a property on the parent form. Can anyone explain the best way to go about this or direct me to a good article?
[Code]...
View 3 Replies
Nov 4, 2010
Trying to access a property from the parent page on my user control.
Here's the start of my default.asp codebehind:
Partial Class _Default
Inherits System.Web.UI.Page
Private _selectedID As String = "74251BK3232"
[Code].....
I'm getting the error "selectedID is not a member of System.Web.UI.Page"
View 2 Replies
May 6, 2010
I have a collection class, say ITEMS, that inherits a Dictionary (of String, SINGLEITEM). From the SINGLEITEM class, I would like to reference a property in the parent ITEMS class, what is the best way to do this? For example, say the ITEMS class has an IsDirty property and I would like to set that if ANY of the contained SINGLEITEM objects is modified, what's the best way to go about doing this?
I know I could add a reference to the collection class in each SINGLEITEM class (since I override the ADD method, I could make this assignment), but this seems like overkill.
View 1 Replies
May 26, 2012
I'm working on a small project and got into some troubles trying to keep it OOP.I have a global variable:
Public Stations As New Microsoft.VisualBasic.Collection()
And 2 classess: Station & Unit:
Public Class Station
[code].....
View 1 Replies
Nov 27, 2011
here any algorithms/pseudocode for reading/parsing 3-column csv data and determining unique objects/attributes/values?
example data:
john,height,1.75
george,age,21
[Code]....
i have already implemented a solution of my own but it's too slow and i can't find any relevant literature on the internet.
View 6 Replies
Nov 10, 2011
Possible Duplicate: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive
I am using window xp and iis 5.1 to run the application.
error is occurred Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
[Code]...
View 2 Replies
Jul 28, 2011
I am using the following code to load an ArrayList with an object. [code]I don't know how to retrieve the object from the ArrayList using the Item property. I am using the following withOUT Success. The code is searching the arraylist for a match on serial number. Values(2) is correct and is working fine - the problem is purely getting the object information from the arraylist.[code]How do I pull the propertys back from the object in the arraylist to compare the values with Values(2)?
View 2 Replies
Jan 4, 2011
I am trying to retrieve the Attributes of a class's property specifically. So for example. Let's say I have a class called "Employee", and a custom attribute called CustomLabelAttribute with a string value. What would I need to do to retrieve the value of CustomLabelAttribute for Employee.FirstName specifically? I assume I will need to use reflection, but it's kind of new to me, and I've just recently started using it on any level.
[Code]....
View 3 Replies
Oct 27, 2009
In the application I'm documenting, sometimes a value is stored in a Public variable & other times it's passed to/from a Public Property which does nothing except store it in/retrieve it from a Private variable. (And in one memorable exception, the Public Property stored it in a Public variable-I'm almost certain that was an oversight by the original programmer though.)
I know that passing it to/from the Public Property has the potential for better validation, but if the Property doesn't actually do anything except store/retrieve it is there any benefit to declaring it as a Property? (Or maybe I should put that the other way around. Personally I'd declare them all as properties because that will allow adding validation later-but I'm not rewriting this, I'm just trying to document it and, in this case, trying to figure out why sometimes it's done as a property & sometimes as a Public variable.)
View 2 Replies
Mar 9, 2009
I am building a real estate website. I have a table for properties (i.e. "houses"), a table for pictures, a table for features, etc. So each property's data comes from three, not only one table. I need to provide a function that retrieves requested property data depending on a search criteria, for example:
[Code]...
View 3 Replies