I’m using the comboBox to show values to select one of them
Those values are from a database, where there are Ids and values.
So, the DisplayMember is the value and the ValueMember is the ID.
the first worked but the second refuses to work at all. And I don’t know why..?
when i try to add a new record using my application, this messeage appears:
An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: System.FormatException: Input string was not in a correct format.
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider)
at System.Convert.ToInt32(String value, IFormatProvider provider)
at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
at System.Convert.ToInt32(Object value)
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <d_id> in S_DESIGNATION_ID Column. Expected type is Int32.
where D_ID is the ValueMember of the comboBox and i need it to be stored in S_DESIGNATION_ID in the data base
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
Thanks And Regards,
Last Visit: 31-Dec-99 18:00 Last Update: 4-Jul-22 15:27