473,387 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Using Enumerated Values to Access Property Collection

Gos
Hi,

I have an enum type as defined below. The enum constants are some of
the properties for a windows form control. I want to store the
settings for that control into a file. In order to access the value of
the properties (for example toolbar.Size or Toolbar.Name) I used a for
loop. In my for loop, I want to do something like
toolbar.[Enum](Prop.GetName)(which is equal to toolbar.Size and
returns the value into the string)

Public Enum ToolBarSettings
Name
Size
Location
End Enum

Dim Properties As Type = GetType(ToolBarSettings)
For Each Prop In [Enum].GetNames(Properties)
Dim s as string = toolbar.[Enum](Prop.GetName) ' I want
this to return toolbar.size into the string)
Next

Is there a way that I can do this?

Thank you
Gos
Nov 20 '05 #1
2 3473
In article <44**************************@posting.google.com >, gowsalya_
79@yahoo.com says...
Hi,

I have an enum type as defined below. The enum constants are some of
the properties for a windows form control. I want to store the
settings for that control into a file. In order to access the value of
the properties (for example toolbar.Size or Toolbar.Name) I used a for
loop. In my for loop, I want to do something like
toolbar.[Enum](Prop.GetName)(which is equal to toolbar.Size and
returns the value into the string)

Public Enum ToolBarSettings
Name
Size
Location
End Enum

Dim Properties As Type = GetType(ToolBarSettings)
For Each Prop In [Enum].GetNames(Properties)
Dim s as string = toolbar.[Enum](Prop.GetName) ' I want
this to return toolbar.size into the string)
Next

Is there a way that I can do this?


Use Reflection. See:

http://tinyurl.com/n0cp

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #2
Gos
It worked.

Thank you very much.
Nov 20 '05 #3

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

Similar topics

22
by: Bradley | last post by:
Has anyone else noticed this problem? I converted the back-end to A2000 and the performance problem was fixed. We supply a 97 and 2000 version of our software so we kept the backend in A97 to make...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
8
by: doomx | last post by:
I'm using SQL scripts to create and alter tables in my DB I want to know if it's possible to fill the description(like in the Create table UI) using these scripts. EX: CREATE TABLE(...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
7
by: Harris | last post by:
Dear all, I have the following codes: ====== public enum Enum_Value { Value0 = 0, Value1 = 10,
4
by: Peted | last post by:
Hi i am trying to make a small mdoification to and exisiting dll control, in its source code. Im trying to expose one of its internal properties so the user can set it in the ide at...
5
by: moondaddy | last post by:
I have a custom control where users can set the backcolor of one of it's UI elements via a DP I created. One of the colors they can pick is a brush called CustomGradient where I would set the DP...
6
by: JFKJr | last post by:
Hello everyone, the following is the Access VBA code which opens an excel spreadsheet and creates combo boxes dynamically. And whenever a user selects a value in a combo box, I am trying to pass...
1
by: JFKJr | last post by:
Hello everyone, the following Access VBA code opens an excel file and creates textboxes in a given range of cells dynamically. The code attaches "MouseUP" and "Exit" events to the textboxes (using...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.