Click here to Skip to main content
15,868,016 members

Comments by Midi_Mick (Top 82 by date)

Midi_Mick 4-Mar-17 1:16am View    
No = the hashset contains all possible permutations, but only once each - it removes duplicates caused by the doubling up of letters. For example, if 5 different characters are entered, there are 120 permutations. However, if 2 of those letters are the same, of the 120 actual permutations, only 60 are distinct - each sequence of letters would be generated twice (once for the letter is the 1st position, and once for the letter in the 2nd position). The hashset removes those duplicates.
Midi_Mick 6-Feb-17 3:10am View    
Nice example.
Midi_Mick 26-Jan-17 19:24pm View    
You need to know which format is being imported. Otherwise, is 2/3/2017 the 2nd of March, or the 3rd of February? And if you CDate "1/25/2017" parsing with the British format defined, you will get an error, as there is no 25th month.

You might want to look at the TryParseExact method (https://msdn.microsoft.com/en-us/library/system.datetime.tryparseexact(v=vs.110).aspx) if you can try to summise what the date structure is going to be.
Note: If you parse without specifying a format, it will use whatever format is defined by your operating system - so you may get different results on different machines.
Midi_Mick 18-Jan-17 8:55am View    
Close, but no cigar. Because of the massive changes made now, I think I might move this question into the C# forums, as discussion seems to be the go. Please don't flame me for doing so - this question as it stands has become invalid in its current state, and would become too large to continue it here.
Midi_Mick 18-Jan-17 6:48am View    
I am creating classes for controls to be instantiated in a CommonFileDialog, using the IFileDialogCustomize interface. As such, my base abstract "Control" class has 2 properties common to all of the controls (ID and ControlState), and will know how to add themselves to the dialog (I declare an abstract AddToDialog method in the base control class). Depending on the type of control, it may contain other properties specific to that control, which would need to be serialised. One of these controls is also a "VisualGroup" control, which itself contains a list of other controls.
These controls are kept in a list within my main FileDialog class (which inherits from Component), and are added to the OS dialog just before they are displayed. I have a custom editor that allows me to enter that list at design time, and I am expecting the VS designer to serialise and deserialise the list as required. It is during the form designer's deserialisation of the list of controls that the error has been occurring - it all deserialises fine at runtime.