473,587 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting a enumerated value as default value

Hi all.

I need to set a default value to my UserControl, but I'm getting a error
when trying reset the value via PropertyGrid on the host IDE: "Object type
cannot be converted to target type".

The value I'm wanting to set came from a enum value. See the code sample:
<DefaultValue(N avigationDirect ionEnum.Down)> _
Public Property EnterKeyDirecti on() As NavigationDirec tionEnum
Get
Return menmEditMode
End Get
Set(ByVal Value As NavigationDirec tionEnum)
menmEnterKeyDir ection = Value
End Set
End Property
[]s
Cesar
Nov 21 '05 #1
1 1044
Found it!

<DefaultValue(G etType(Navigati onDirectionEnum ), "Top")> _
Public Property EnterKeyDirecti on() As NavigationDirec tionEnum
Get
Return menmEnterKeyDir ection
End Get
Set(ByVal Value As NavigationDirec tionEnum)
menmEnterKeyDir ection = Value
End Set
End Property

[]s
Cesar

"Cesar Ronchese" <ronchese*smlin fo.com.br> wrote in message
news:eX******** ******@TK2MSFTN GP12.phx.gbl...
Hi all.

I need to set a default value to my UserControl, but I'm getting a error
when trying reset the value via PropertyGrid on the host IDE: "Object type
cannot be converted to target type".

The value I'm wanting to set came from a enum value. See the code sample:
<DefaultValue(N avigationDirect ionEnum.Down)> _
Public Property EnterKeyDirecti on() As NavigationDirec tionEnum
Get
Return menmEditMode
End Get
Set(ByVal Value As NavigationDirec tionEnum)
menmEnterKeyDir ection = Value
End Set
End Property
[]s
Cesar
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
367
by: Milosz - [playseven.com] | last post by:
Dim EP As System.Net.IPEndPoint = New System.Net.IPEndPoint(mIP, mPort) Dim S As Socket = New Socket(EP.AddressFamily, SocketType.Dgram, ProtocolType.Udp) S.SetSocketOption(Sockets.SocketOptionLevel.Socket, Sockets.SocketOptionName.SendTimeout, Me.mTimeOUT) .......
18
18339
by: Dixie | last post by:
Can I set the Format property in a date/time field in code? Can I set the Input Mask in a date/time field in code? Can I set the Format of a Yes/No field to Checkbox in code? I am working on a remote update of tables and fields and can't find enough information on these things. Also, how do you index a field in code?
22
2121
by: Ben Finney | last post by:
Howdy all, I've recently packaged 'enum' in PyPI. In its description, I make the claim that it creates "immutable" enumeration objects, and that the enumeration values are "constant" values. This raises questions. Is there any difference between a Python immutable value, and a constant? I suppose "constant" also implies that the *name*...
1
1275
by: Nick Bassiliades | last post by:
Hi everybody, I would like to ask a very specific question about how I can re-define an enumerated attribute type. Specifically, I have two XML Schema files. In file A I have the following attribute group declaration: *********** file A ****************** <xs:attributeGroup name="kind.attrib">
4
4378
by: Shawnk | last post by:
This post is intended to verify that true value semantics DO NOT EXIST for the Enum class (relative to boolean operations). If this is true then (thus and therefore) you can not design state machines in C# where the machine can use the enumerated 'state' to execute (thus the term 'machine' as in 'state machine') the machine operations as...
1
6466
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located...
7
2617
by: John Goche | last post by:
Hello, The following program compiler and runs fine under gcc and produces the output 3. However, I am not sure whether such behavior is legal. In particular, as a related question, how would I go about checking that a supplied integer is contained within the set of values of an enumeration? Is there a way to do this? Thanks,
1
1607
by: senfo | last post by:
I'm using an enumerated type to identify a record type that relates to a unique ID in a database. Identity columns in SQL start at 1, while enumerated types in C# start at 0. I didn't think it would be a big deal because I could just force the values of the enum to start at 1. Database: ID RecordType -- ---------- 1 TypeA
6
3556
by: DippyDog | last post by:
This is an old old post that I'm referencing regarding what happens when you set an integer variable to Nothing. It gets set to zero, not "Nothing." http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_thread/thread/6732ea8e7016bd24/70608745c29d048b?lnk=gst&q=can%27t+set+enum+to+nothing#70608745c29d048b Just to expand...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.