Reusable Custom Control With Properties?
Nov 13, 2009
I have built a Custom Control Class that makes it much easier to build a side bar element in my html.
The problem I am running into is that when I set the "Text" property, the last time I set it gets used for every instance of the control on my page. This is my first time doing this, so I'm assuming I'm missing something basic.
[Code]...
View 1 Replies
ADVERTISEMENT
Nov 14, 2009
This is similar to my last post but with a different purpose.I have built a custom control, but when I set the properties for it... ALL instances of that control on my page grab the exact same property. I need to be able to set the property to "abc" for one instance of the control on my page, and then set the exact same proprty to "xyz" for a different instance of the control on the same page.
[Code]...
View 1 Replies
Nov 25, 2009
What I've done is create a User Control Library (Project) and I've added a single User Control to that project. The control contains a single FlowLayoutPanel, and I created a Property on the control itself to pass the FlowDirection from the Control to its FlowLayoutPanel child.
Build, reference, component appears in the Toolbox and everything works fine, but the property on the control does not appear in the Properties window when I go to edit it at design time.
View 6 Replies
Apr 16, 2009
In our IDE, for example, Visual Studio, if we display the properties of a System.Windows.Forms.Button control, we see some properties that expose anoter set of properties. For example: FlatAppearance, Font, Location, Margin, etcetera.I would like to do something similar in a custom control.I know the code behind is wrong, but here is an example of what I´m trying to do:
Public Class StateOfMyCustomControl
Public Enum EnumVisibility
Visible
[code]....
In my IDE, in the properties window of my custom control, I would like to see my property State, with the possibility of display it to set the properties Visibility and EventManagement.
View 1 Replies
Apr 10, 2012
I want to do a class that have properties like font, which will have other properties, such as name, size, unit,bold.
<TypeConverter(GetType(ExpandableObjectConverter))> _
Class TestingClass
'Some property here
End Class
View 1 Replies
Mar 21, 2010
Is it possible to make a form that can set the properties on a custom control in the designer? What I mean is I want to know if it is possible to show a dialog that allows you to set the settings for a certain property like if you were adding items to a listbox.
View 3 Replies
Mar 16, 2010
I have a custom list control, using labels to display content.How can I add a list property to the control so I can inject items into the custom listbox?I know how to make properties for strings etc. but I can't get it to work to make a list property...
View 1 Replies
Mar 6, 2012
I have a custom VB.NET control that I created that is working correctly in one program but not in another.The control has one button and one form. The form displays some data based on the settings in the control.
[Code]...
In TestProject1 - the control is working as expected In TestProject2 - the control is not sending any of the settings I set to the form My control works fine when I debug with the UserControl TestContainer.
I am using VB.NET on VS2005. This is all done on the same machine. Why would this work in one project and not another?
View 1 Replies
Aug 12, 2010
I have a custom control and have created some properties for it.When I click on that control, its properties are then shown in the PropertyGrid.The problem, is that I only want to show some of the predefined properties as well as my custom properties.Does anyone know how I can filter out the properties I want shown?
View 9 Replies
Jun 22, 2011
Is there a way to not put the project name in the Inherits attribute?
I am working with vb and I have multiple projects, that have multiple web pages. In each of these projects I create controls that are reused in the web pages.
Each control I have is declared like this:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="MenuBarControl.ascx.vb" Inherits="**projectName**.MenuBarControl" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
When I want to copy the control into another project I have to change the **projectName**. Having to change the project name for each project makes the code not reusable. Changes made to specific projects each time is not reusable.
I want to be able to omit the project name in the Inherits attribute. When I do that now I get an error
Parser Error
Parser Error Message: Could not load type 'MenuBarControl'.
View 2 Replies
Aug 15, 2011
Asking for little guidance again... For my custom control, I grouped some properties in some class. Then in the main control code, I use:
[Code]...
View 7 Replies
Oct 15, 2011
I've created a user control with a simple text box and a corresponding label and added a few custom control properties. When added to a form, I'm trying to loop through all control of this type and evaluate the custom property. In the below, the cntl.MyCustomProperty is not recognized. I can evaluate the property when I check each user control on the form by name, but not by using the loop below. I would much rather use the loop as it is much cleaner.
For Each cntl As Control In Me.Controls
If (TypeOf cntl Is MyUserControl) And cntl.MyCustomProperty = "ABC" Then
''Do some stuff
End If
Next
View 2 Replies
May 14, 2011
I have a custom control defined in code-behind:
Public Class MyControl
Inherits Button
Private _A As String
[Code]......
What code I have to write to bind to those properies?
View 1 Replies
May 13, 2009
I've created a Custom Control, and I will be placing a large number of instances of that Custom Control on my xaml page. In working with that Custom Control in the VB Code Behind, how do I do the following?
How do I reference the name of the Custom Control (in my VB code) which was clicked with the MouseLeftButtonDown event? For example, if I have 10 instances of my Custom Control in xaml, each with a different x:name (say 1-10), when a particular instance is clicked, how can I see which one was clicked? I've tried a number of things including e.OriginalSource.Name (which returns the component within the control which was clicked and not the name of the instance of the control). My Custom Control consists of numerous parts and pieces (Rectangles, Lines, Text, etc). Each of these items is a part of my layer. In VB code, once I can reference a particular Control, how can I hide or change certain parts of that control (such as hiding a Line, and changing the text). Also, I need to modify more than just the control which was clicked, so I need to be able to access properties of all of the controls, not just what was clicked. For example, if I click Control instance Test1, I also need to modify Test2, Test3, and Test5 in some way.
Here is some test code I through together as part of a Silverlight project using MS Blend 2. My control is much larger, and I need 200 - 250 instances/copies of that custom control, so I really need to know which control instance/copy was clicked.
My UserControl:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
[Code].....
View 1 Replies
Apr 4, 2011
I can load a generic user control just fine in my WCF service doing the following:
UserControl userControl= (UserControl) new Page().LoadControl("~/UserControls/MyControl.ascx");
However i can't seem to find any way to do this
[code].....
View 2 Replies
Apr 26, 2012
[code]I want to make the Properties Window to update the properties for X and Y at each MouseMove, so they become immediately visible for the user.
View 2 Replies
Oct 21, 2009
I've populated a PropertyGrid with a custom class. How do you create and display a sub property similar to Size (Height, Width) which has two values or Point(X,Y)? For example, the class is Test and the property is Item as string. I want to expand Item to have two sub properties, A and B.
View 1 Replies
Apr 27, 2011
I'm making a control and I am trying to finalize my design time properties grid. I have several List(of Class) items as public properties and when I click on the design time menu (while testing the control) there is the word "Collection" and a button with an ellipsis (...) that brings up a neat pop up with the buttons Add/remove and all of the public properties of the collection's class on the right hand side. Basically for a non-collection instance of a class (with public properties) I'd like a similar button to show up. I know I could put all of the properties in the main control class and group them, but I like the pop up box feature. Anyway to duplicate this? (think font grid item etc.)
View 3 Replies
Dec 29, 2011
how to specify a custom icon for display in the toolbox window when you create your own custom control? Something other than the dreaded "gearbox" icon.
View 2 Replies
Nov 6, 2008
I have my own class of graphic objects, and now I'd like to allow a user to right-click on one of those within the application and see a properties window. Is there a pre-built dialog or control for displaying properties at runtime? I'd like to have something just like the IDE properties window button for my application.
View 4 Replies
Jun 14, 2012
I need to implement some (maybe 10) custom properties for logged in users for my MVC3 vb.net web app. These will define how certain data is displayed within my views. I can think of a couple of possible solutions..
[CODE]....
View 1 Replies
Aug 25, 2009
I was thinking to put attributes on BLL classes properties which ever are mandatory and I'm successfully able to retrieve the attributes also. But, not I also want to check the value of propeties. How I can do that:[code..]
View 1 Replies
Jun 21, 2010
I created a custom datagridview column for a progressbar and included customizable color properties but I can't get them to work right. After compiling, the properties show up correctly in the Edit Columns popup editor, but changing the values has no effectThe designer generated code shows the original values and manually changing them there has the desired effect(I know you're not supposed to, just testing). Here is the code for the column even though I don't think the issue is stemming from any coding errors there.
Imports System.Drawing
Imports System.ComponentModel
Imports System.Drawing.Drawing2D
[code].....
View 2 Replies
May 31, 2009
I'd like to add some custom properties to the columns of my DataGridView control. I'm not sure how to do it.I tried this once before but never got it finished. Basically, I'm making a teacher gradebook. Fore each column, I need to add properties called Assignment,DateAssigned, DateDue, PerfectScore, AssignmentType, etc.
View 6 Replies
Oct 22, 2009
I have developed a Windows service application in VB.NET.My need is to have custom property tab like "General", "Log On", "Recovery", and "Dependencies". Because I need to configure my service and also want to display some extra information in that extra tab.
View 2 Replies
Sep 30, 2009
I'm moving my first steps in the VB.NET world (I come from VB6) and I'm stuck with the creation of a particular class.
Let's say we have a bus that always has 101 places. I'm trying to create a class containing the map of the bus, along with methods to graphically represent it.
My "Bus" class will have a couple of properties ("BusColor", "BusModel") related to the whole bus. Then it should have a property called "Places" whose type is a custom class thet represents every single place, along with, for example, the passenger name or the place number. This property should of course be an array.
This is my code so far (simplified):
Public Class BusMap
Private Const MAX_PLACES As Integer = 101
Private _BusModel As String = ""
[Code]....
but I wonder if there is a more standard way of doing this.
My second question is: how can I modify my class to be able to iterate its Places property with the "for each" statement? A quick search on the web showed up that I should implement the IEnumerable interface, but I'm still not enough confident with the concept of Interfaces.
View 6 Replies
Jul 15, 2009
Lets say i'm making a new dialog. I don't want to expose the properties of the form to code elsewhere, only specific ones I define. I tried making the form Protected (including the Designer generated code) and putting it in another class, but then I can't figure out how to access the form from my code. Am I going about this completely the wrong way, or what?
Code:
View 5 Replies
Oct 29, 2009
Is it possible to iterate through the properties and methods of a custom class, getting the details about those properties and methods in the process.[code]....
View 2 Replies
Nov 13, 2011
I'm working on a project where I need to information on all the monitors connected to a computer and then write a configuration file based on that. I can already get the screen information by creating a new instance of screen and reading the information such as index, bounds and everything else.I'm trying to create a virtual screen object to hold the information from the screen so I can work with it, or add other properties to it.[code]This all works perfectly how I want it to. Except I would like to do one more thing. How can I make it so that instead of getting Virtual_Screen.Top, I could get Virtual_Screen.Bounds.Top? That way I could create other properties such as Virtual_Screen.Border.Top..I have no idea how to code, or what that would be called. It's hard to search for something you don't know the name of.
View 5 Replies
Feb 1, 2011
I am trying to learn how to create Windows Forms custom controls in VB.Net by creating a .Net version of an old control I created in VB6. On this control, I have a UserControl with a Label (lblCaption), and several of the properties I add to the control should be passed to the label.This is the code I tried for the ForeColor property:
Code:
Protected mcolForeColor As Color = Color.FromKnownColor(KnownColor.ButtonHighlight)
Public Overrides Property ForeColor() As Color
Get
[code]....
When I change the ForeColor on the control in my test project, lblCaption does change to the color I selected; however, when I run the application, the label changes back to the default (button highlight) color, and the value of the property is also reverted back when I return to the form designer.What would be the proper way to implement the ForeColor property on a custom control?
View 4 Replies