|
-
February 1st, 2005, 03:15 AM
#1
Converting a String to Integer [C#]
Given a DropDownList box [ddlHour] and a DateTime variable [dtSelected].
I want to update the hour in dtSelected.hour with the ddlHour.SelectedValue however when I try to do the following directly:
dtSelected.Minute = ddlMinute.SelectedValue;
I get the following error:
1) Cannot implicitly convert type 'string' to 'int'
2) Property or indexer 'System.DateTime.Hour' cannot be assigned to -- it is read only
So I guess I have 2 questions; how could I convert the string returned by ddlHour.SelectedValue into an Integer so I can update the dtSelected.hour AND why am I seeing that read-only error? Am I not doing this right at all?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|