How To Set Description Of A Property In Custom Server Control
Sep 2, 2009
I have created a custom Server Control and I want to add a description to the properties and events that the control holds. I have looked over the Internet and came up with the following.[code]Unfortunately this does not seem to work in visual studio .net 2008.
I created one web user control with property named "ReadonlyField" with boolean datatype. I am able to use in my web pages and now i wanted to add a description to that property so that i dont need to explain each time to my team member what is that property's intention.
I got following snippet in c# but didnt find any equivalent in vb.net and also not sure whether it will work or not.
[Description("My Description")] public int MyIntProperty { get {..}
I created one web user control with property named "ReadonlyField" with boolean datatype. I am able to use in my web pages and now i wanted to add a description to that property so that i dont need to explain each time to my team member what is that property's intention.[code]...
I have an ASPX Custom Control which is supposed to load it's properties into an internal collection (defined with PersistenceMode.InnerProperty). Here's the ASPX
I have created a custom class, which contains a panel and a label on it. I added to this class a pcaption property, which holds the label text. This property is browsable and I can change its value.But when I drag the custom control to the form and change the pcaption property, it has no effect. Even the <Defaultvalue> has no effect. Why?
Here is the class code:
Imports System.ComponentModel Public Class mypanel Inherits Windows.Forms.Panel Private panelcaption As String
I am developing a custom control with VB9, and I want to add a Property Name TextFileName this property need to use OpenFileDialog, which type I can use when I define this property?
for example another property I use is EnterFocusColor and its type is System.Drawing.Color so when the user select the property it opens the ColorSelectionDialog Hany M. El Tarhony
I'm trying use just a user control form to act like the old VB6 picturebox. Mainly, i'm doing this is because a user control form is also a container but i also want it to have an image property. I've done this. The new control does have an Image property but the problem is that the user control form doesn't have an image property but only a BackgroundImage property.I was hoping that there is some way to place the selected image, directly on the surface of the user control and not to it's BackgroundImage property. Here is what is got so far:
Code: Public Property Image As System.Drawing.Image Get Return Me.BackgroundImage End Get
[code]....
As you can see, for now, i have to use the BackgroundImage property but i want to image to be placed on the controls surface, so that the image can be manipulated, like drawing game tiles on it or image processing. The user control doesn't have a real image property?
What I want is a property that like Font property, it has "Name", "Size", "Unit", "Bold" and the other property in it. I tried the solution in the post I tried the solution like this:
<TypeConverter(GetType(ExpandableObjectConverter))> _ Class TestingClass 'Some property here
I've created a custom control in VB.NET on .Net 3.5, in VS2008, which contains a load of custom properties, including RSS feed address, proxy address and proxy port.This control is an RSS ticker, which works really nicely, but doesn't initially run at all, and from stepping through my code, this is because none of my properties are being passed data from the containing form, until after the control has been initialised, and the code behind the control has run. The code (relevant bits) looks as follows:[code]
How to get a property to persist after its been changed dynamically during run-time? When Visual Basic reverts back to the IDE, the property goes right back to its original value.
I have a custom control. I need to add a property, say, Comparison, to the control. The property should be set at design time using a dropdown. The Dropdown will have String values like '=','>','<' etc. I tried using Enum values and working perfectly but I need to do some extra coding to convert the Enum values to the string I required. It would be great if I can get the values from the dropdown so that I can directly use the selcted value.
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?
I am creating an Extended DateTime picker. I have created a Class the inherits the Default DateTimePicker and Adds a new Property NullableValue. I have placed the control on a form and bound it to a Binding Source using the NullableValue Property. When I load the record the control updates as it should. But when I change the value and save it does not save back to the database.
I have a custom version of a label control (built using a user control). While working in the designer, I want to intercept the setting of the Name property (in the properties panel) and use it to generate the Text property. That is, if I enter "lblFirstName" into the Name property of the properties panel I want to immediately see that the Text property is set to "First Name". Parsing the Name property is not the issue; I can do that.
I have tried to overload/shadow the Name property (since "Overrides" is not allowed) to essentially add this "aspect" to our custom label control but it doesn't seem to hit the Shadowed method at design time. It does hit the Shadowed method at run time if manipulated via code. The point is to avoid double the work as the label text and the label name are essentially the same. The only difference is one is formatted to be human friendly and the other machine friendly.
<System.ComponentModel.Browsable(True), System.ComponentModel.ParenthesizePropertyName(), System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Visible)> Public Shadows Property Name As String [Code] .....
This may be a matter of picking the right attributes. Conversely, if it's an easier alternative, we could allow setting the Text property to set the Name property. I doubt this would be easier since it should also reflect the new name in the Designer.vb code, not just in the label's Name property itself.
I've in my app many self created custom controls (not as a real active x control, but a simple modified class). In this case I'm writing about a groupbox. I've placed many of them on different forms. But now, I want to change the backcolor of this controls. I change the backcolor in the class, rebuild the project, and the backcolor didn't change. Why? I don't want to place the groupbox again, it would be too much work. It should be a chance to do this whithout placing the groupboxes again.
I am making a custom button control and am having some difficulty with my Text property. Anything I type in only stays while the form designer window is open. When I close the form designer and reopen it, my Text property resets to "". Also if I run the program, it loses the value entered at design time.
I also have an Image property for my control which is working just fine.
I want to add a custom property to a button in window form. Currently i am using following code to create my logic. but i want to create an enum value for a button control.
I have seen that BindableAttribute is used to decorate public properties in custom controls. MSDN briefly mentions that it provides the ability to control the binding direction and whether binding is supported at design time.
public class MyControl : Panel { [Bindable(BindableSupport.No, BindingDirection.OneWay)] public string MyString { get; set; }
[code]....
1) I set BindableSupport to No, however I could still do this in markup (.aspx).What does BindableSupport affect then? Does it hide the property in the toolbox?
I want to create a custom control (let say textbox), after build, when I place that custom control on a form, all the properties for the default textbox are available.
1- How to Hide them and only show the wanted property and method?
2- Is there a Wizard or custom tool for creating custom control or I had to do every thing by coding?
I created a Custom Class and Implemented a Type Converter for it. I used this Custom Class as a new property of a Custom Control.Everything is fine at design time. I can set the values of this property but at run-time the values i entered resets back to the initial declaration i made.
I have created several simply custom controls and I used them in my app. Now, I changed the background color in a custom control class, because I wanted an other color for this type of control. But in my app, the background of this controls didn't change. Why? I assume, I don't need to place again this controls on each forms to get the new background color, or do I? If yes, this is very stupid in my opinion.
I have a custom control and would like the properties to be mandatory (not default) when a programmer codes the control. Is there a good way to do this without throwing exceptions in the program?
If we say blue is the default colour of the Backcolor property I understand it as if you don't specify a colour for Backcolor blue will be its colour. But I could not make sense of default property of a class in the context of building a custom user control. After calling an instance of a class we have to either call one of its members or assign an other object for it. Therefore why should there be a default property?
When using the Property Grid and exposing a color property from an object you get this kind of interface for color selection: There are tabs for System and Web, those are fine, but the Custom tab (shown) which seems to be a subset of the standard windows color picker, seems to be hobbled. How do you create custom colors? How do you get custom colors into those white color boxes provided?
The MessageText property is a multiline text, and the user must be able to set the text using the designer. The problem is that the designer doesn't allow to enter a newline directly for a string property.I want the same behaviour as the system TextBox's Text property, where you can click on the down arrow and write lines in the small text-editor that appears:How do I do that?
I've created a custom user control that has several properties. One specifies which database I want the control to access. I want to be able to present the user of the control a drop down from which he can select which database the control will interact with. How do I get the dropdown to work? I can get default values, but have yet to figure out how to get the selectable list.
Is it possible to create a user control with a list of custom class type property? If it is, how can I? The issue is that, in designer mode the property is not displayed in property window. I can add the list on markup but when i switch to the designer mode it gives an error which is 'The user control does not have a public property named BookList'.