473,748 Members | 2,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Intellisense parameter dropdown for enum parameter, How?

How do I get Intellisense to open a dropdown list box for a method's
parameters when the parameter is an ENUM?

public class MyClass
{
public enum IDkind
{
PersonID,
EntityID,
PlaceID
}

/// <summary>
/// Gets an ID value of a particular KIND
/// </summary>
/// <param name="K">The kind of ID desired</param>
public int IDget(IDkind K)
{
return (int) IDsArray.GetVal ue(new int[] {(int) K});
}
}
=============== ============

Then, in another location I type:

MyClass.IDkind IDtype = MC.IDget(

When I type the last parenthesis above, Intellisense automatically opens and
shows me the Method's Signature and my parameter's description, like this:

int MyClass.idGet(M yClass.IDkind K)
K: The kind of ID desired

That's fine .... but now I want Intellisense to open a dropdown list of the
valid MyClass.IDkind enum's to choose from.

How?
Nov 15 '05 #1
2 5695
frederick, have you tried typing IDKind. int he method signature? After you
type the Enum name it will give you a drop down of the valid values.

--
Greg Ewing [MVP]
http://www.citidc.com

"msnews.microso ft.com" <fr*******@qpop .com> wrote in message
news:O9******** ******@tk2msftn gp13.phx.gbl...
How do I get Intellisense to open a dropdown list box for a method's
parameters when the parameter is an ENUM?

public class MyClass
{
public enum IDkind
{
PersonID,
EntityID,
PlaceID
}

/// <summary>
/// Gets an ID value of a particular KIND
/// </summary>
/// <param name="K">The kind of ID desired</param>
public int IDget(IDkind K)
{
return (int) IDsArray.GetVal ue(new int[] {(int) K});
}
}
=============== ============

Then, in another location I type:

MyClass.IDkind IDtype = MC.IDget(

When I type the last parenthesis above, Intellisense automatically opens and shows me the Method's Signature and my parameter's description, like this:

int MyClass.idGet(M yClass.IDkind K)
K: The kind of ID desired

That's fine .... but now I want Intellisense to open a dropdown list of the valid MyClass.IDkind enum's to choose from.

How?

Nov 15 '05 #2
if you are doing this from another class (as I was the other day when i
ran into this), there are two things.

Example 1: Accessing from different class, same namespace

namespace project.namespa ce1
{
public class MyClass
{
public enum IDkind
{
PersonID,
EntityID,
PlaceID
}

/// <summary>
/// Gets an ID value of a particular KIND
/// </summary>
/// <param name="K">The kind of ID desired</param>
public int IDget(IDkind K)
{
return (int) IDsArray.GetVal ue(new int[] {(int) K});
}
}
public class OtherClass
{
//here you would reference the enum by
//MyClass.IDKind. PersonID
//tying . after IDKind should pop up the members
}
}

Example 2:
however, if you are going to be referenceing from a different namespace:
namespace someothernamesp ace
{
public class OtherClass
{
//here you cannot reference the enum by
//MyClass.IDKind. PersonID
}
}
what you would need to do in this case is put the enums you want
accessible OUTSIDE of the class, but inside the namespace
namespace project.namespa ce1
{
//put enum here
public enum IDkind
{
PersonID,
EntityID,
PlaceID
}
public class MyClass
{
/// <summary>
/// Gets an ID value of a particular KIND
/// </summary>
/// <param name="K">The kind of ID desired</param>
public int IDget(IDkind K)
{
return (int) IDsArray.GetVal ue(new int[] {(int) K});
}
}
public class OtherClass
{
//now you can just access via the enum name
IDKind.PersonID
//because of shared namespace
//and intellisense will find it.
//and this solves the problem of accessing from another
//namespace as illustrated below
}
}
then in the other namespace,

using project.namespa ce1
namespace someothernamesp ace
{
public class someclass
{
//you can just access the enum by name
IDKind.PersonID
//and hitting . will have intellisense bring up the
//members
}
}

hope that helps.
Greg Ewing [MVP] wrote:
frederick, have you tried typing IDKind. int he method signature? After you
type the Enum name it will give you a drop down of the valid values.


Nov 15 '05 #3

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

Similar topics

2
1475
by: Ben R. Bolton | last post by:
I have found that Intellisense sometimes works and sometimes doesn't. I have yet to detect a consistant pattern, but have observed that if I define a public enum in one project, that enum is accessable in other projects, but it is not visible via intellisense. If I am working in the same project the enum is visible via intellisense. How do I make an enum visible to intellisense accross projects? Ben
1
4293
by: Steve Long | last post by:
Anybody know how to make intellisense show a drop down the list of an enum as a method argument like it does for .NET types? Example: public enum eGroupPlacements { GRP_RECORD, GRP_REPORT };
2
1844
by: Ken Durden | last post by:
Is there any way to control ordering of items in intellisense via attributes? For example, I have the following enum: public enum ESeverity { Acceptable, Low, Medium,
1
2067
by: Jim | last post by:
Given a function: MyFunc( MyEnumType arg) { ... } I have noticed that sometimes (but not consistently over different functions or classes), that when I call MyFunc() in code, Intellisense will provide me a list of possible
2
1702
by: Kevin Johnson | last post by:
H I have an ASP.NET datagrid written in C#. When editing my datagrid it contains one dropdown list and 4 normal textboxes I need the dropdown list to contain all of the colors in the System.Drawing.Color class for selection. I am unsure how to go about this. Could anyone help and provide coded examples Any help highly appreciated Thank
3
1355
by: Rick Palmer | last post by:
Hello all, I have a function I have written that gets Invoices by a date range. It looks something like this: GetInvoicesbyDateRange(ByVal LBound as Date, ByVal UBound as Date, ByVal CompareTo as ????) as integer The ???? is where I have a problem. When I am using this function in code, when I get to the CompareTo field, I want it to pop up intellisense giving
2
6284
by: Ron | last post by:
Hello, Is there intellisense for vb.net dll's? Here is a simple dll I wrote which I invoke in MS Access. Note: I set the build property to include registration for Com Interop = True: ---------------------------------------------------- Imports System.Runtime.InteropServices Namespace dllVB
10
2244
by: Michael Feld | last post by:
Hello, does anyone know how to produce a data type which offers Enum-like IntelliSense in VS 2005? What I am trying to create is a type which is very similar to an enum, i.e. has a fixed set of values, but provides some more methods. Unfortunately, you cannot derive from System.Enum to do this. I noticed that if you type "Dim C as System.Drawing.Color = ", the editor will display a list of colors, but this are actually ReadOnly Shared
4
1104
by: fdeckerNOSPAMM | last post by:
Hi, If I do this in module myConstants.bas: Global const One = 1 Global const Two = 2 Global const three = 3 Then in my code, all I have to do is: if ThisConstant = myConstants. and when I type the dot, Intellisense shows all of the constants. But if I don't want hundreds of constants
0
8832
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9558
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9331
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9253
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6077
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2216
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.