|
The binary representation of a fraction is an approximation. Using float or double you'll never get a straight answer, but an approximation.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello,
I've been trying like crazy to figure out how to copy an object of a custom type to the Clipboard via Clipboard.SetDataObject() and then retrieve it with Clipboard.GetDataObject().
I've tried everything I can think of. I declare a DataObject, made out of my custom object, and give it a format name, and send it to the clipboard. Then I bring it back from the clipboard, as an IDataObject, use GetDataPresent(*format name", true), and it says that the data is present. But when I use GetData, it returns null! What is going on here?
There are many demos about how to use the clipboard with strings and bitmaps but that's pretty useless. What's the point of C#'s clipboard support if all you can do is transfer bitmaps?
|
|
|
|
|
|
C# doesn't have clipboard support - .NET exposes the Windows clipboard service to managed languages such as C#.
If you're trying to transfer an object from one AppDomain to another, it won't work. You need to serialize the object and deserialize it on the other end, sort of using the clipboard like a low-tech remoting channel.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Thanks for the quick answer. Someone else wrote the code to use the clipboard and it turns out that this is not necessary--the data is not intended to be copied into another application anyway.
|
|
|
|
|
I have a list of files names in an ArrayList that I want to find and show in one window, like the find feature does in explorer. I am thinking of using the find method and open the folders containing the files. However, I want to be able to show the files in different folders together in a window.
Any suggestions appreaciated, please include code
Thanks,
ff
|
|
|
|
|
Hi,
I'm looking to find the most effective and fastest way to get the duration of a MP3 file.
Code examples or links to lib's would be helpful thanks in advance,
Richard
|
|
|
|
|
Take a look at Reading MP3 Headers[^].
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
This is really frustrating for me.
I'm using both the DTS Com Component in C#, to programatically create a DTS package, save it, then execute it.
Here's the COM exception that got thrown.
Error Code : -2147024882
Source : Microsoft Data Transformation Services (DTS) Package Description :
Not enough storage is available to complete this operation.
HelpFile : sqldts80.hlp
HelpContext : 1100
InterfaceError {10020306-EB1C-11CF-AE6E-00AA004A34D5}.
This definately, can't be a storage or memory issue, as i have 80gig of HD space and 4Gig of Ram. Please advice.
What this DTS Services does is, grab the access files, and insert it into the SQL Server. If there are 10 files, 10 process will be spawn.
Stanley
|
|
|
|
|
I also had this problem in the past. I tried almost everything that was possible, but did not succeed.
The solution, in my case, was creating an unmanaged COM component in VC (you can try using VB6, too, I bet it'll work) and calling DTS from there. Then, I called this new COM component from C#.
Yes, even I am blogging now!
|
|
|
|
|
See, it's the DTS.dll and DTSPump.dll I'm incorporating.
Anyone ?
Stanley
|
|
|
|
|
This really got me thinking.
Now, instead of spawning the process running concurrently of each other, what if i put those process on a Queue. In other words, the process will run one after another.
Would this be any better ?
Stanley
|
|
|
|
|
Hi Gurus,
I managed to solve this mystery puzzles.
I just want to share with the c# community as to how this problem is fixed.
Now first of all, the problems described aboved has nothing to do with not having enough memory or hd space. The reason why this is happening is due to DTSLookups. Now, my production server is running on w2k Advance Server, and my testing server is on windows 2003 (since we're moving in this path).
On the w2k environment, the dts code works. But, it doesn't work with the w2003 environment. To workaround this issue, I have basically, removed all the DTSLookups and introduce another extra steps (stor procedure) to do what the lookups was doing. Up to this point, no more com exception errors, once the workaround has been implemented.
Note:- The error description thrown here is meaningless.
Stanley
|
|
|
|
|
Hello again, Gurus
1. How can you find out which row and column when the mouse hovers or moves over a DataGrid control? NOT MOUSE CLICKING!!! My app is windows-based C#. I am trying to display the contents of the current cell under the mouse pointer in either the grid's tooltip or context-menu.
I already tried out the DataGrid.HitTestInfo & DataGridHitTest, suggested by another Gury. But It seemed only work with Mouse clicking (MouseDown event) only.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsdatagridhittestinfoclasstopic.asp
2. I am not sure where to display the cell contents in the grid's tooltip, context-menu, or something else?
Appeciate your input & thanks with another million,
Khang
|
|
|
|
|
DataGrid.HitTest does work, but when not clicking you need to convert the mouse coordinates from screen coordinates to client coordinates. When you click the mouse, the control's event already translates the coordinates for you.
It's quite simple:
Point p = MousePosition;
p = dataGrid1.PointToClient(p);
HitTestInfo info = dataGrid1.HitTest(p); When you respond to mouse clicks, do not translate the coordinates, remember, since they are already translated to client coordinates (client being the control) for you.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Hello again, Heath
I tried both ways:
// Point p = MousePosition;
or
Point p = new Point(e.X, e.Y);
I always got the same row# and col#, no matters where I moved the mouse over the grid data rows:
Row$0:Col$1
Row$0:Col$1
Row$0:Col$1
Row$0:Col$1
Row$0:Col$1
.....
private void dgSelectedParts_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
System.Windows.Forms.DataGrid.HitTestInfo hti;
// Point p = MousePosition;
Point p = new Point(e.X, e.Y);
p = dgSelectedParts.PointToClient(p);
hti = dgSelectedParts.HitTest(p); // DataGrid
Console.WriteLine(String.Format("Row$0:Col$1", hti.Row, hti.Column));
}
Thanks,
Khang
|
|
|
|
|
For the mouse events you do not translate the coordinates when you use MouseEventArgs , but when you use MousePosition you do (since those are in screen coordinates). I mentioned this in my previous post. If you read the documentation for the MouseEventArgs , you will find this well documented.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Heath, you know everything!
I got the right row# and col# so far. However, I want to display the grid cell contents in the ... (tooltip or contextmenu or something else). Do you know how to do that or a link to the information?
I appreciate your help and thank you so much,
Khang
|
|
|
|
|
Searching the articles on this site or browsing the catalogies is a good place to start. Several articles discuss such features with the DataGrid . Just be sure you're reading an article about the Windows Forms DataGrid (System.Windows.Forms.DataGrid ) and not the ASP.NET DataGrid (System.Web.UI.WebControls.DataGrid ). The two are very different.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles]
|
|
|
|
|
Heath, you're very kind and helpful.
Thanks so much,
Khang
|
|
|
|
|
The ASPNET account is only used by IIS for ASP.NET (2002) based web sites. It has nothing to do with Windows applications.
The user that is running the application (you, while you're coding/debugging) has to have permission to access the files in question.
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Hi there.
I need your help again.
Is it possible in C# to save a program that we are running for later, if we want, could load it in the same project again.
What I want is something similar to load file, but instead of a text file I want to load the project that I were running.
Thanks very much, Sérgio
|
|
|
|
|
Hi,
Could you little more specific ?
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Thanks but I already solve my problem.
What I´m doing is to gatther all information in a XML file when I want to save. When I want to load I´m going to the XML file and read all that I need.
|
|
|
|
|
Hello group,
Here is the scenario...
There is a .dll (written in C#) available in the same folder as my application.I'm using reflection to dynamically load the assembly and call the methods available in that dll.
However, the system hangs when it is trying to call the methods in that dll. FYI, i'm able to successfully create an object for the dll's class. The problem is in the line i call the "Invoke" method. That is, the control is NOT passing to the next line after "Invoke" and it remains in the same line for an infinite amount of time. I've attached the method (at the end of this post) for your reference.
Any suggestions would be greatly appreciated.
Thanx,
Ananth
------------------------------------------------------------------------------
//Method starts here
private string CallFunction(string assemblyPath, string className, string methodName, string[] param)
{
try
{
if (! System.IO.File.Exists(System.Windows.Forms.Application.StartupPath + "\\" + assemblyPath))
{
return "The dll is not found in the installation directory.";
}
else
{
assemblyPath = System.Windows.Forms.Application.StartupPath + "\\" + assemblyPath;
}
Assembly objAssembly = Assembly.LoadFrom(assemblyPath);
if (objAssembly == null)
return "";
AssemblyName objAssemblyName = objAssembly.GetName();
string strAssemblyShortName = "" + objAssemblyName.Name;
objAssemblyName = null;
Type objType = objAssembly.GetType(strAssemblyShortName + "." + className);
object o = Activator.CreateInstance(objType);
int ct = param.Length;
object[] paramObj = new object[ct];
for (int i=0;i
|
|
|
|