By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,039 Members | 1,035 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,039 IT Pros & Developers. It's quick & easy.

Parsing content from textboxes efficiently

P: n/a
Hi there
Iím trying to come up with a smart way of parsing content from
textboxes in C#. I have about 7-10 boxes with different content;
dates, times, numbers and text that has to be parsed and inserted into
my database.
Of course the obvious solution is to make a lot of ifís and parse each
box one at the time with the properties I know and catch all
exceptions on the way, if any, but does anyone has an idea of a
smarter way of doing this?
Thought about making a list of the boxes with content, so I donít have
to waste time parsing the empty ones and catching exceptions.

An example of how I'm parsing a Textbox containing a date:
if (BeginTime.Text != "__:__:__")
ad.DateTimeBegin = DateTime.ParseExact(BeginDate.Text,

CultureInfo.CurrentCulture.DateTimeFormat.ShortDat ePattern,
Jul 24 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.