Hi there
I=92m 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=92s 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=92t 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 !=3D "__:__:__")
{
ad.DateTimeBegin =3D DateTime.ParseExact(BeginDate.Text,
=20
CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern,
null);
}
Regards
Lasse