|
Hi all
i have a c# windows application project. When i press the "close" box, i receive the error below. Does anyone know what should i do to fix this error?
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll
Additional information: Specified argument was out of the range of valid values.
thanks
Ozgur Nevres
|
|
|
|
|
Does your form override OnClosing or OnClosed , or does anything else (including your form) handle the Closing and Closed events? If so, something is invoking (either directly calling or invoking via reflection) a method that isn't getting passed the right arguments.
If this isn't the case, something somewhere is calling a method with an argument that is not acceptable (for instance, passing a value that doesn't represent a single enum member or a flagged enum). The best way to find this out is to actually read the documentation for the classes, methods, properties, et. al. that you're using. Almost every member in the .NET base class library (BCL) gives at least directly-thrown exceptions that could be thrown and why they would be thrown, including what values are allowed for a particular parameter.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks for your care.
Yes, i handle the Closing event. My eventhandler is below:
(Note: the error does not occur always, it occurs sometimes ( 1 in 10, average )
private void Server_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if ( !CheckOnlines() )
e.Cancel = true;
}//End of Private Method Server_Closing.
and my CheckOnlines method:
private Boolean CheckOnlines()
{
int i = this.m_iNumOfOnlineOperators
+ this.m_iNumOfOnlineVisitors;
if ( i > 0 )
{
TextObject objTO = ( TextObject )
this.m_htTexts["Server_CheckOnlines_Msg2"];
String strMsg = objTO.TextValue;
strMsg = strMsg.Replace(
"@", this.m_iNumOfOnlineOperators.ToString() );
strMsg = strMsg.Replace(
"$", this.m_iNumOfOnlineVisitors.ToString() );
objTO = ( TextObject )
this.m_htTexts["Server_CheckOnlines_Msg1"];
DialogResult dr = MessageBox.Show(
this, strMsg, objTO.TextValue, MessageBoxButtons.YesNo,
MessageBoxIcon.Information );
if ( dr == DialogResult.Yes )
{
return true;
}//End of if ( dr == DialogResult.Yes ).
else
{
return false;
}//End of else.
}//End of if ( i > 0 ).
else
{
return true;
}//End of else.
}//End of Private Method CheckOnlines.
|
|
|
|
|
It's hard to see where an error might occur, so you should try debugging that method and seeing on which line the exception is thrown. You should also try stepping through the code (put a breakpoint on the first line of your Closing handler and step into each line. The low reproducability rate might make that a little tedious, but that's the world of software development. You could also use Debug.Assert which may speed up the process a little. Good luck!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I have visual studio .NET 2003 but how do I create a project in C# ? If I go to New -> Projects I get all the managed C++ items but how can I create C# projects? If I just create a file, I do not have the option of a .cs file - must I download something or will it compile .cs files as it is?
Obseve everything, remember more...
|
|
|
|
|
Check our VS.NET installation. Have you installed C# support?
|
|
|
|
|
No, how do I install C# support?
Obseve everything, remember more...
|
|
|
|
|
Re-run the setup and select C# when choosing installation components. If C# is not an option, then you only bought Visual C++ .NET and not the full studio. Either buy the full studio or buy C# .NET to go along with it. If you can return Visual C++ .NET, I'd recommend doing that and getting the full studio since it'll most likely cost you less than buying two separate components.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks
Obseve everything, remember more...
|
|
|
|
|
how do i remove/hide/clear control border? i need datagrid, listiew, listbox or textbox that has no border, and i use it in .NET Compact Fromework on WinCE 3.0
please help... Thanks
|
|
|
|
|
Set the "BorderStyle" property to "None", if it exists in .NET Compact Framework.
|
|
|
|
|
property BorderStyle is not available for .NET Compact Framework. I want it to be programaticly hiding control border.
|
|
|
|
|
Hi,
I'm getting the following error "The request failed with http status 404: Not Found" when trying to execute a web method on a web service from a client windows app. The webservice works fine when running the web service on it's own. I've tried updating the web reference, removed the Web Service and added a new one and ported the code over to the new WebService, basically tried everything I can think of but no success.
Does anyone have any ideas?
Thanks in advance.
|
|
|
|
|
Are you providing all parameters of the correct Type when calling the method? If you are using inherited objects, try casting them to the parameter
Type instead of relying on the CLR to handle it. This may be causing a problem with resolving the correct web method. <br />
<br />
<div style="width: 100%; font-size: 4px; margin-bottom: -10px; background-color: rgba(255, 153, 0, 1)"> </div><br />
-----BEGIN GEEK CODE BLOCK-----<br />
<a href="http://www.geekcode.com/geek.html">Version: 3.21</a><br />
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++<br />
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Looks to be OK in regards to both of your suggestions.
Thanks for trying
|
|
|
|
|
Hi
"The request failed with http status 404: Not Found"
|
|
|
|
|
Thanks for your helpful advice in using UserControl in web!
I did a windows service to serve my application . I use socket to send and receive data from and to application , but it has more time to transfer large data .What's technique that I can use for improve my speed .My application and service are running in same host .
Thanks for your help!
|
|
|
|
|
Is there a way to display a window form inside an panel?
|
|
|
|
|
Not without doing some Windows API tricks. But first, can you design your form as a control instead?
|
|
|
|
|
Probably you should start from investigating the IDE with Spy+.
|
|
|
|
|
|
use the "SetParent" api , this way you can tell a form that its parent is your panel..
//Roger
|
|
|
|
|
Regards,
I need a well knowledged buddy discuss me runtime type member(method, property) access using System.Reflection, from performance point of view and memory usage.
I need a comparison with direct develop-time type invoke.
any benchmark or any explanation is appreciated,
Thanks
---
limit nSun = God
n → ∞
|
|
|
|
|
Reflection is generally slow. There is an article somewhere on MSDN comparing various performances. Sorry no link to it.
leppie::AllocCPArticle("Zee blog"); Seen on my Campus BBS: Linux is free...coz no-one wants to pay for it.
|
|
|
|
|
Ok sure it is rather slow for he first use, but doesn't .NET framework perform some approach for example some sort of cashing to speed it up for second and later invokes?
---
limit nSun = God
n → ∞
|
|
|
|