You can call functions written in C compiled to a .dll from .NET by providing what is effectively the function prototype and marking it with a DllImportAttribute. More information can be found here[^].
It's probably not that hard to draw outside the control boundaries, but it's not very good to do so. You will have problems with the drop down disappearing if the controls behind it is redrawn, and the code to hide it would have to find all the controls behind it to force a redraw.
Just create a new control for the dropdown. That way the control will be able to properly handle redraws, it won't be drawn over by other controls, and hiding it will be simple, as the controls behind it will automatically redraw when it's removed.
I was Testing my program, which is a thread/database intense program. I ran it in VS, and it runs perfectly and all of a sudden gives me a popup box with this message:
Managed Debugging Assistant 'RaceOnRCWCleanup' has detected a problem in 'C:\Documents and Settings\Wallace\My Documents\Visual Studio 2005\Projects\Visual Waiter\Visual Waiter\VWServer\bin\Debug\VWServer.vshost.exe'.
Additional Information: An attempt has been made to free an RCW that is in use. The RCW is in use on the active thread or another thread. Attempting to free an in-use RCW can cause corruption or data loss.
What does this mean? whats RCW?
It looks like to be that everytime this message pops up, the program is stopped at
Maybe I am closing the connection somewhere else? so i have 2 .Close() somehow causing race condition?
I used threadpool in my prgoram to handle the threads, it seems like that it is only running 2 threads at the same time. I hope there is a property i can set in Threadpool that i can increase the amount of concurrent running threads??
It actually sounds like your trying to close a connection that still had a query pending. Perhaps your opening a connection on one thread and running a query on that connection on another thread???
RCW stands for Runtime Callable Wrapper. It's the wrapper code that your .NET Managed code calls to get at unmanaged COM code, like controls or libraries.
There is no property to increase the number of concurrently runnable threads. What may be limiting the number of threads is whatever your calling in those threads. Like the SQL server your connecting to doesn't have any more connection licenses? Or the server your connecting to doesn't have any more open connections?
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
How did you expect me to answer that? There are so many ways of writing database access code and even more ways of doing it wrong it's impossible for anyone to guess at what you're doing and how you're doing it.
About the best I can do is tell you that your database code should follow a pattern: Open the connection to the database as late as possible, do your database work as quickly as possible, then close the connection as early as possible. Do not open a connection as part of a class to make it visible anywhere within the class. You will have less control over the lifetime of the connection.
I want to do some actions immdiately after the form load automatically.
How do I do it. If I do in form load then it happens before the form is loaded. But I want to do after the form is loaded.
How do I do it..Thanks.
One solution could be to attach an event handler for Application.Idle in the Load event handler and then perform your work there:
privatevoid myForm_Load(object sender, EventArgs e)
// Do whatever you need when the form is loaded
Application.Idle += new EventHandler(app_Idle);
privatevoid app_Idle(object sender, EventArgs e)
Application.Idle -= new EventHandler(app_Idle);
MessageBox.Show("This happens almost immediately after myForm_Load has returned!");
I'm working on a project with some pretty math intensive calculations that must output double values. After much testing, it was determined that we have an accuracy out to 10 digits after the decimal point. This is adequate for what I'm working with so we kept going forward.
Now, in the next phase of the project, comparisons have to be made between two structures that contain the double results, so I overloaded Equals() to do a comparison to the tested accuracy. Immediately I found some big problems with this. Because of the way Equals() is determined, I run into the problem where the following is true: A==B, B==C, A!=C. I'm a bit stumped on how to fix this. There must be a way, but I'm not really seeing anything.
I created the following test code to illustrate my problem:
staticvoid Main(string args)
SomeStruct val1 = new SomeStruct(1.0);
SomeStruct val2 = new SomeStruct(1.0);
SomeStruct val3 = new SomeStruct(1.00000000009999);
SomeStruct val4 = new SomeStruct(0.99999999999);
Console.WriteLine("Starting . . .");
Console.WriteLine("val1 == val2");
Console.WriteLine("val2 == val3");
Console.WriteLine("val1 == val3");
Console.WriteLine("val1 == val4");
Console.WriteLine("val3 == val4"); // problem, this doesn't happen
privatestaticdouble accuracy = 0.0000000001;
public SomeStruct(double val)
Value = val;
publicoverridebool Equals(object obj)
if (obj is SomeStruct)
return (Math.Abs(Value - ((SomeStruct)obj).Value) < accuracy);
Anyone have any ideas?
----- In the land of the blind, the one eyed man is king.
Yes, val3 - val4 is greater than accuracy, but that leaves me with the problem that val3 == val1 is true, val1 == val4 is true, but val3 == val4 is false. A==B, B==C therefore A==C is a basic mathematical principal that this is breaking, and I'm afraid will cause problems, and I can't figure out a way around it.
Truncation isn't quite right either, that way 1.0000000001 and 1.00000000009 wouldn't match up.
I've since rewritten the equality method, to get much better results but no matter how I change it, I still can't get around that basic problem.
BTW, I've thought about using the Decimal structure for internal calculations, but I don't know how much it would gain me when most of the intermediate results will be stored outside of my class and will be in double.
----- In the land of the blind, the one eyed man is king.
I have table with 2 columns
DataSet dsABC = new DataSet();
I am have a problem extracting the data from the columns ....
While I am doing
int Age = dsABC.Tables.Rows["AGE"];
It says "Cannot implicitly convert type 'object' to 'int'".
Is there any way can we assign datacell to an int with out using Conver.Int32
I like to wrap all controls before I use it in my own projects. It would be usefuel if the wrapped control is still accessible from the outside world. I can define a property on the wrapper and hand out the instance of the wrapped 3rd party control.
private 3rdParty.Controls.Button _button;
public 3rdParty.Controls.Button WrappedButton
This way one is able to access programmatically. But if one changes something in the visual designer, the changes made on the wrapped control are lost, because they aren't written down by the designer into the IntitalizeComponents() method.
Is there any way to tell the designer to store the init settings for the wrapped control as well?
myMsg.BehindDaKeys = "Jerry Maguire";
-- modified at 13:05 Thursday 19th January, 2006
Last Visit: 31-Dec-99 18:00 Last Update: 27-Jun-22 4:36