|
IsAssignableFrom work for inheritance but not for explicit or implicit cast. About second method maybe you are right, but I'm not sure that there will have no preblems if I work with boxed long instead of int, if int is required (like parameter value for SQLCommand as example).
So I want to check if object from some type can be safly casted to another type. I have tried to find what cast operators the type have but have not found anyway to do that. Maybe there is some method like Type.GetMembers() that return all cast opertors for specific reflected type? (GetMembers() do not return cast operators)
|
|
|
|
|
Well you can always enclose the casts that are important in a try...catch block and catch the InvalidCastException. I mean using exceptions to control a program flow is not a good programming practice, but I don't see another way to do it at runtime. What are you going to be casting? Something like this:
object someExternValue = ... get this value ...;
int param = (int) someExternValue;
If you are doing it like that, you can use the Convert.GetTypeCode method to get a TypeCode of an 'object' variable. So
TypeCode tc = Convert.GetTypeCode(someExternValue);
if (tc != TypeCode.Int32)
{
.. ok to cast to int ..
} else {
.. not ok ...
}
hope this helps
|
|
|
|
|
Hi everybody,
What do you think? What is better choice: Dundas Ultimate Toolbox or Dundas Chart for ASP.NET???
thanks in advance
|
|
|
|
|
That is like asking "Which is better: a washing machine or a fridge?"
If you are going to be drawing charts in ASP.NET then go for Dundas Chart. If you are going to be developing Windows applications using MFC go for Dundas Ultimate Toolbox.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
Hi Colin,
I'm going to be developing both(charts in ASP.NET, Win. App. with MFC). I would like know your opinion which one is more useful?
|
|
|
|
|
First, I've not used the Ultimate Toolbox and it has been a few years since I did and MFC development, so I cannot really comment on that. From what I've seen on the web site it looks great.
Dundas Chart is one of the best charting toolkits available so I'd recommend it.
But back to my previous post: "Which is better a fridge or a washing machine?".
If you're going to be working on both projects why not get both. If it is a budget problem and you only have the resources for one then you need to prioritise. (Using my analogy above) Do you need to wash your clothes more urgently than store cold food?
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
|
Miško wrote:
So, this is reason, why i'm asking "stupid" question.
Sorry, I didn't mean to cause offense. I never said your question was stupid.
What I was trying to do was to draw the answer from you. I think that you are the only person that knows the answer to the question, because you know best what you are likely to be doing in the near future.
Why not look at it another way? Which will you get more long term use from?
Which ever choice you go for, good luck.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
I am developing a Compact Framework app that reads files created by a "legacy" desktop application.
One of the values it must handle originated as a COleDateTime and was written to the file as a double . I can read the double easily enough, but how can I get it into a System.DateTime ?
Thanks in advance for any advice.
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
Convert it using the rules for DATE :
public static DateTime DateTimeFromOADate( double oaDate )
{
DateTime dtOrigin = new DateTime( 1899, 12, 30, 0, 0, 0 );
double absDate = Math.Abs( oaDate );
double intPart = Math.Floor( absDate ) * Math.Sign( oaDate );
double fracPart = absDate - Math.Floor( absDate );
DateTime dtConv = dtOrigin.AddDays( intPart );
dtConv = dtConv.AddDays( fracPart );
return dtConv;
} The bizarre maths comes from the fact that DATE isn't a true number-line: a number's whole part and fractional part are considered separately. The whole part is a number of days relative to 30 December 1899, while the fractional part is always a positive offset to the time within that day (e.g. a fraction of 0.25 always represents 06:00, even if the number is negative).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Excellent! Thanks.
I just came up with the same thing except for the bizarreness. I think I can do without the bizarreness anyway. The application in question wasn't recording data before 30 Dec 1899!
The opinions expressed in this communication do not necessarily represent those of the author (especially if you find them impolite, discourteous or inflammatory).
|
|
|
|
|
I like to be complete
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Do you need VS. NET to run the Pocket PC 2003 emulator, I have Borland's C# Builder (free) and wanted to try some some programing for it since i dont have a Pocket PC yet.
modified 16-May-21 21:01pm.
|
|
|
|
|
|
yea its what i was afraid of beging a 56k'er. I just read on the help file that came with the SDK and it said something about starting the emulator without eMbedded Visual C++, using the command line, but i guess you need the eMbedded C++ or VS .Net.
modified 16-May-21 21:01pm.
|
|
|
|
|
Can i still run my .Net apps (well .Net compact) with the pocket PC emulator in eMbedded Visual Tools?
modified 16-May-21 21:01pm.
|
|
|
|
|
hi, its me again is there a free tool for developing applications for pocket pc/smart phones the uses the .NEt Compact Framework?
Is the .NET Compact framework SDK available for download?
Can SharpDevelop do mobile applications?
thanks a lot
|
|
|
|
|
Hi,
Can any know how to create, edit and display help when F1 is clicked for each control in VB.NET
Sreepathi.
|
|
|
|
|
Hi, is there any free IDE for VB.NET/C#/.NET Framework, if there is any.........what is the most popular? (aside from web matrix, i need a free tool for windows app)
|
|
|
|
|
Emacs with a C# add in - You'll need to Google for it though.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
SharpDevelop and the personal edition of Borland C# builder come to mind.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Where is the code that draws the graph? It sounds like the same thing could happen when ever anything else obscured the graph too. Is this the case? (Try placing another window on top of the graph then moving it off again - Do you get the same thing?)
If you put the graph drawing code in the OnPaint() method (you will need to override it from the base class) it should redraw when the window is damaged. If this is not happening then perhaps the date picker needs to notify the graph that it is damaged. In this case you will need to use Refresh() to get the graph to draw itself again.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
|
|
|
|
|
Hi,
I used the following code to know the control which has focus:
System.Windows.Forms.AccessibleObject.GetFocused
The error I got is 'GetFocused' is not a member of 'AccessibleObject', but Documentation says, it is a member.
Do you any one know how to find the focused control.
Thanks,
Sreepathi
|
|
|
|
|
This will return a currently focused control on a form IF the form does not have any container controls on it.
<br />
public Control GetFocused()<br />
{<br />
foreach(Control ctrl in this.Controls)<br />
{<br />
if (ctrl.Focused)<br />
{<br />
return ctrl;<br />
}<br />
}<br />
return null;<br />
}<br />
This is a universal way of getting the currently focused control:
<br />
public class MyForm : Form <br />
<br />
{ <br />
<br />
[DllImport("user32.dll", CharSet=CharSet.Auto, CallingConvention=CallingConvention.Winapi)] <br />
<br />
internal static extern IntPtr GetFocus(); <br />
<br />
<br />
<br />
private Control GetFocusedControl() <br />
<br />
{ <br />
<br />
Control focusedControl = null; <br />
<br />
<br />
IntPtr focusedHandle = GetFocus(); <br />
<br />
if(focusedHandle != IntPtr.Zero) <br />
<br />
<br />
focusedControl = Control.FromHandle(focusedHandle); <br />
<br />
return focusedControl; <br />
<br />
} <br />
<br />
} <br />
|
|
|
|
|
Please, help.
I have a problem: i have few .Net projects. I need to make one multimodule assembly, wich contain this projects as modiles. How can i compile project as module.
PS I can make few assemblies, but i need that my classes in assemblies where friends. (like "internal" in assembly). Can i do it.
PPS Sorry for my english.
Thank you.
sieben
|
|
|
|