|
I'd guess you have to download them. Maybe this Google result[^] helps.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
What's wrong with this????
The date string I'm trying to parse is initially in this format - "date: wed, 16 mar 2011 17:09:37 -0700". I pull off the "date: " portion and remove the comma. That results in "wed 16 mar 2011 17:09:37 -0700".
Here's my code:
string[] words = Line.Split(' ');
string dtstring = words[2].PadLeft(2, '0') + " " + words[3] + " " + words[4] + " " + words[5];
DateTime datetime = DateTime.ParseExact(dtstring, "dd MMM yyyy hh:mm:ss", CultureInfo.InvariantCulture);
I'm getting "String was not recognized as a valid DateTime."
Help!
Everything makes sense in someone's mind
|
|
|
|
|
have you looked at the value of dtstring at all?
please check your words indexes, they seem all wrong.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Yes I have. dtstring contains "16 mar 2011 17:09:37"
Everything makes sense in someone's mind
|
|
|
|
|
there seems to be something inconsistent in your posts.
anyway, two comments:
- maybe, I don't know, ParseExact needs month names in the expected casing (Mar)
- are you aware ":" is not just a colon in DateTime formats, it really means "whatever the separator is for time parts on your system"?
So try with a modified dtstring and/or read the documentation!
ADDED: and then there is HH versus hh of course.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Try HH instead of hh...
DateTime datetime = DateTime.ParseExact(dtstring, "dd MMM yyyy HH:mm:ss", CultureInfo.InvariantCulture);
I may or may not be responsible for my own actions
|
|
|
|
|
VOILA!! That did it
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
So it was a 'Good Answer' then
I may or may not be responsible for my own actions
|
|
|
|
|
Good job. I should have refreshed the page before posting the answer.
|
|
|
|
|
I was half expected to see the same thing happen after I hit submit... these kind of posts are always a race against time
I may or may not be responsible for my own actions
|
|
|
|
|
Oh yes. Good catch.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
It's HH not hh . You're using 24 hour format, not AM/PM.
|
|
|
|
|
Hello!
I wish to have an icon (Path ) which scales forever until some background operation is finished. I managed to bind a DataTrigger to my dependency property InProgress . However, I want the animation to repeat so I bound RepeatBehavior to InProgress as well. Here I get an exception "'Set property 'System.Windows.FrameworkElement.Style' threw an exception.' Line number '241' and line position '22'.". The inner one is: "Cannot freeze this Storyboard timeline tree for use across threads."
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding InProgress}" Value="True" >
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard AutoReverse="True"
RepeatBehavior="{Binding Path=InProgress, Converter={x:Static Converters:BooleanToRepeatBehaviourConverter.Instance}}" >
<DoubleAnimation To="0.125" Duration="0:0:0.12"
Storyboard.TargetProperty="(LayoutTransform).(ScaleTransform.ScaleX)" />
<DoubleAnimation To="0.125" Duration="0:0:0.12"
Storyboard.TargetProperty="(LayoutTransform).(ScaleTransform.ScaleY)" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
The exception started to occur after binding the RepeatBehavior . Before doing that, the animation displayed correctly but only once. Note that I have been using the InProgress property for binding before and it worked. The converter:
public class BooleanToRepeatBehaviourConverter : IValueConverter
{
private static readonly IValueConverter instance = new BooleanToRepeatBehaviourConverter();
public static IValueConverter Instance
{
get { return instance; }
}
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool) value
? RepeatBehavior.Forever
: new RepeatBehavior(0);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
How to solve the problem?
Thanks in advance!
Greetings - Jacek
|
|
|
|
|
You should have asked this in WPF forum[^] dude which is appropriate one.
|
|
|
|
|
|
|
|
Thanks a bunch jerk, now I can't delete my message until you delete yours. Did you not see my comment to Jacek? The reasons I gave my original response were entirely justified because of the way that the forums are intended to be available for use later on and not just now. Now I can't delete this thread chain, and I have to leave it there to give context.
some_beginner wrote: It is just natural that people ask those questions because they hope that the
professionals here either have been in the same situation and are thus able to
provide a good answer or maybe even a solution
Yes, but in the correct forum, not where whim takes you. Honestly, it's as if you don't care that other people are meant to be able to search for solutions to problems that have been solved before.
|
|
|
|
|
I had to read your message three times before I could beleive you'd written in in seriousness.
Given your total two/three year contribution to the site is five messages, two of which can be seen in this thread, do you think it is appropiate that you should tell someone who is a regular (and a pretty decent and helpful chap to boot) what to do here? The OP posted on the wrong thread, it dimishing the usefulness of this site as a research tool.
Two other aspects of professionalism you missed: Getting your facts straight and not hurling insults.
Oh, and if you can't stand the occaisional "acid" comment get out of IT now, you'll never succeed.
|
|
|
|
|
Keith Barrow wrote: if you can't stand the occaisional "acid" comment get out of IT now
5!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Note: I set the property using Dispather.BeginInvoke{...} . Can it be an (indirect) source of exception? I cannot check it right now so please think of it anyway.
Greetings - Jacek
|
|
|
|
|
You should really have moved this back to the WPF forum. The issue is that resources that are in or consumed in a control template have to be frozen. This is done so that the resource can be shared across control instances quickly. Once you set the binding on the Dependency Object on a Freezable, you stop it from being frozen.
As you can't create a static resource of the RepeatBehavior, I'd suggest that this is one of those instances where it is perfectly legitimate to have code in the code behind of the view. Don't tie yourself into logical knots here - view specific code in the view code-behind is legitimate.
|
|
|
|
|
Hi,
I want to Update a TreeView() method of the MDI Child Form (Form Project;) by clicking a button on another MDI Child Form (Form AddPhase;). Both Forms are open in the MDI container, however AddPhase is active.
MDI Parent name = MainForm
How do I do that?
Greetzzz....
G
|
|
|
|
|
The best way is to have AddPhase raise an event, which MainForm subscribes to. It can then route the information to Project either again via an event or via a property as seems appropriate for you design. That way, only the MainForm knows about the existence of (and interrelation between) the two MDI children.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Thanx for the reply,
I already found the answer. Using a public interface IChangeNotification works!
G
|
|
|
|