TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Simon Bennetts
NA
3
1.2k
Lookup constants based on object names
Jan 28 2014 10:57 AM
Hi,
I have a windows application which places default / help values in empty text boxes on the form in gray to show the user what is supposed to be entered (e.g. FORENAME in my txtForename textbox) in the textbox.
I have a generic event for all my textboxes on Enter to remove the text, change back from gray and add the change event. On exit, I'm checking if they've entered anything and would like to refill the textbox with it's default value if they've left it blank or delete it later.
I have a ParametersDefaults class which contains a list of constants with the same name as the text box objects (e.g. public const string txtForename = "FORENAME").
What I want to do is get that string value based on the sender object (which will always be a text box).
Something along the lines of
((TextBox)sender).Text = DefaultParameters.[sender.Name bit goes here!]
I'm sure there must be an easy way but I can't figure it out and it's only Tuesday!
Thanks in advance
Simon
Reply
Answers (
2
)
Define a base class called animal with following members:
delete row from gridview and database