|
You can't set a DateTime to null.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
That's not what I would call a reasonable practice. I prefer my DateTimes to be valid in some way (and use new DateTime(0) to accomplish that).
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote:
That's not what I would call a reasonable practice. |
It is a possible and valid scenario, whether you John, agree with it or not. Just saying...
For instance, shipping dates - they are usually null until something actually ships.
|
|
|
|
|
We can argue the validity of nulls all day. I don't like 'em, and I strive to resolve them in some way.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
One would use a "shipped event", in that case.
One could drop and smash the shipment .... One does not carry a null "damaged date" in anticipation.
|
|
|
|
|
I don't think you would set a DateTime to string.empty .
|
|
|
|
|
Of course you can't. But I don't know how they are working with the actual data and displaying it. I am starting to regret posting an answer to his question.
|
|
|
|
|
Slacker007 wrote: I am starting to regret posting an answer to his question.
Waaa-waaaa-waaaaaaaaaaa.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
You know John, you don't "always" have to be an a**hole.
|
|
|
|
|
Yes. Yes, I do. If I wasn't always an assh*le, I would disappoint my legions of fans. Besides, me being an assh*le is really the only constant in life any more that absolutely EVERYBODY can count on.
Beyond that, I was just poking you in the ribs. If you're honestly butt-hurt, I can call a waaa-mbulance for you.
BTW, I'm the one that voted your original answer a 5.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
|
Why are you yelling at me?
|
|
|
|
|
Read the whole thread - the answer is there.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Actually (to build on Slacker's answer), the return value of the TryParse method is either true or false, and if true, the specified out parameter contains the parsed DateTime value. If the return value is false, the specified string was not in a recognizable DateTime string format.
Additionally, if you know for sure what the format of the string will be, you can use ParseExact .
For details about using either of these methods, google is, once again, your friend.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Thanks, I corrected my post.
Funny, I use this all the time, yet I posted its implementation incorrectly.
|
|
|
|
|
I am using dgv printer to print datagridview and wold like to know how to close the printing box if an exceptions is encountered.
|
|
|
|
|
|
datagridview printer, I downloaded it from this website and I am using the dll version because I am programing in vb.net using visual studio community 2015.
Sorry for that.
|
|
|
|
|
So it's from an article then? You should really ask your question in the forum at the end of the article. It's extremely unlikely that the author of that piece will just happen to wander through the C# forum and realise that you have a question for her or him.
This space for rent
|
|
|
|
|
|
I need .net solution (c# preferred) for this. I need to read data from USB flash drive, not by normal file reading way, but byte by byte using its memory address. I used winusbnet library. But
USBDevice device = GetSingleDevice(myguid)
always return null. I have checked guid resides in registry. Also I confirmed the guid in device manager too. But I can't figure out what went wrong.
|
|
|
|
|
Which library are you using? Is this USBDevice from a Windows or .NET namespace? The UsbDevice [^] object (notice the object caps and smalls) can be used which comes from Windows Runtime APIs and can be used in Metro applications. You can check that API out. Please see the document on MSDN for more on this.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I'm writing an app that supports plugins, using the SimplePlugins library.
Plugins live in a separate subfolder.
Both the app and its plugins reference the SimplePlugins DLL.
For the plugins, the SimplePlugins assembly performs a sanity check to ensure that the plugin module includes at least one object derived from PluginBase (that lives I the SimplePlugins assembly).
So in the grand scheme of things, the app loads first, and uses the SimplePlugins creates a new app domain for each plugin assembly, and then performs said sanity check which calls the IsSubclassOf reflection method.
The sanity check fails unless I change the Copy local property for plugin's reference to SimplePlugins.DLL to false.
My question:
Why doesn't IsSubclassOf find the specified derived type without setting Copy local to false? Is it because I'm crossing app domains? Is it because the plugin is loading a different copy of the SimplePlugins DLL?
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
More information is needed.
- What is the base directory of the AppDomains?
- How are you triggering the code in the AppDomain?
- Is the SimplePlugins.DLL also stored in each plugin-subfolder?
- Which assemblies are now loaded in the appdomain? Debug to find out the exact location.
- 'Why doesn't IsSubclassOf find the specified derived type' - does not make sense. IsSubclassOf returns either true or false.
|
|
|
|