|
I have never had that error before, but a quick check on MSDN:
http://msdn2.microsoft.com/en-us/library/6a71f45d(VS.71).aspx[^]
* Integer arithmetic overflow either throws an OverflowException or discards the most significant bits of the result (see below). Integer division by zero always throws a DivideByZeroException.<br />
* Floating-point arithmetic overflow or division by zero never throws an exception, because floating-point types are based on IEEE 754 and so have provisions for representing infinity and NaN (Not a Number).<br />
* Decimal arithmetic overflow always throws an OverflowException. Decimal division by zero always throws a DivideByZeroException.
What are you trying to do?, you'll need to show some code.
Regards,
Gareth.
|
|
|
|
|
Varad_Rajan,
OK, i understand a bit better now. Like i said in my first post, whats the event your using to display the ContextMenuStrip?
Regards,
Gareth.
|
|
|
|
|
I am not using any event to display the context Menu Strip.
It is declared as
private System.Windows.Forms.ContextMenuStrip DimensionModify;
in class designer of form When I add it in visual designer.
I am using DimensionModify.show() or DimensionModify.Hide() to display or hide the contextMenu .
|
|
|
|
|
Varad_Rajan,
If you have added it to the TreeView1.ContextMenuStrip property in the designer, why do you need call Show() or Hide(), as its automatically done and you don't need to worry about that.
Regards,
Gareth.
|
|
|
|
|
You are right Gareth. It automatically appears as you said.
But in certain situations for functional aspect I need to show or hide it.
But the problem comes when I press key down after I show the context Menu.
The control after that for keydown always goes to context menu. Why is not coming back to Treeview for Keydown.
|
|
|
|
|
The only thing i can think of is that the context menu still has focus. So you when close the context menu, you need to set the tree view to have focus.
Regards,
Gareth.
|
|
|
|
|
My doubt is After the context menu is displayed, the context menu is still there even after I close it explicitly. When I minimize and maximize the form the keydown event is going back to treeview. But I am not able to achieve this programatically.
|
|
|
|
|
I tried Gareth , focusing, activating treeview But still the keydown control goes to ContextMenu. I tried to Minimize and Maximize the form programatically to make context menu lose focus but it is not working.
Thanks
|
|
|
|
|
This is wierd. How about trying to disable, then enable the context menu. Disabling it should stop it doing whatever it is, that its doing.
this.contextMenu.Enabled = false;<br />
this.contextMenu.Enabled = true;
Unless of course re-enabling it straight away means that nothing actually happens. Don't know 'till you try i guess.
My current favourite word is: Nipple!
-SK Genius
|
|
|
|
|
Through VS 2003 (.NET 1.1) we are generating an XML file, the owner of the file is always Computer Name. But we want the windows user, creating the file to be the owner.
We have achieved this change in ownership through VS 2005 (.NET 2.0), but are unable to do so in VS 2003 (.NET 1.1). If anybody has any knowledge on this do share it with us.
Destination folder in which the file has to be created is in shared path on another server.
Any help in this regard will be highly appreciated.
Thanks in advance!
|
|
|
|
|
Hello all...
Can any one please tell me how can we add .rpt and .cri extensions in IIS (windows 2000 with crystal reports 9 installed on the same). For crystal report 8 we need to map these extensions to "C:\Program Files\Seagate Software\WCS\Wcsinsapi.dll" but this is not the case with CR 9, so i am wondering if anybody knows how will it work for crystal report 9(CR 9).
Any suggestion will be helpful... i really got while trying it from 1 whole day... please help me friends...
People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily
Akhilesh Singh
|
|
|
|
|
Hi all,
I've been laboriously opening and closing SqlConnections, SqlCommands and SqlDataReaders etc. until I recently found out about the nice using approach to all of that.
using (SqlConnection mySqlConnection = new SqlConnection(...))
{
mySqlConnection.Open();
using (SqlCommand mySqlCommand = new SqlCommand(...))
{
using (SqlDataReader mySqlDataReader = mySqlCommand.Execute())
{
...
}
}
}
One thing that I am unsure about though has to do with the scope of a SqlConnection if used this way.
Let's say for instance that I have two functions that perform an action against the database, myFunc1() and myFunc2() . Inside each of these functions the SqlCommand and SqlDataReader is implemented. If a connection is established as described above, it will not have scope inside such a function:
using (SqlConnection mySqlConnection = new SqlConnection(...))
{
myFunc1();
myFunc2();
}
On the other hand I don't want to open the SqlConnection first in each function. I've heard talk of "connection pooling" so it might not be a problem to do so but I don't know about that. If anyone would care to explain conection pooling I'd appreciate.
But basically, my question is. Is there an elegant way of making the SqlConnection available to other functions that will be called from inside the using block or would it be better to have a good old instantiation of a SqlConnection class at the top, open it manually and then close it manually again?
I suppose one solution would be to pass the SqlConnection as a parameter to the function that will be working on it but for some reason I don't like that.
I'm sure there's an industry-wide accepted norm for doing this type of thing. Throughout the application there are references to the database but you don't want to open and close the DB connection every time.
|
|
|
|
|
Dewald wrote: I suppose one solution would be to pass the SqlConnection as a parameter to the function that will be working on it but for some reason I don't like that.
Why ? That is the easy method. You can do it like
using (SqlConnection mySqlConnection = new SqlConnection(...))
{
myFunc1(ref mySqlConnection );
myFunc2(ref mySqlConnection );
}
If you don't want to pass the connection, try the following.
private SqlConnection mySqlConnection = null;
using (mySqlConnection = new SqlConnection(...))
{
myFunc1();
myFunc2();
} In this mySqlConnection is declared as private in the class. So you will get access to all methods.
When I have created a DAL, I implemented IDisposable interface and provided a Dispose() method which clears my SQLConnection instance. It will be instantiated in the constructor. So it would look like
public class MyDAL : IDisposable
{
SQLConnection mySqlConnection = null;
public MyDAL()
{
mySqlConnection = new SqlConnection(...);
}
public void Dispose()
{
}
}
You can call this like
using(MyDAL dal = new MyDAL())
{
} In the above code, you haven't passed any parameters to the methods.
Hope it helps
|
|
|
|
|
Hi,
I need to copy some Content in Excel Sheet and send that Matter as a Mail Content in body of that Message not as attachment.
I used Excel .dll i.e Microsoft Excel 11.0
Is there any way to do this.
Thanks in advance.
|
|
|
|
|
Look into the methods that come with the Office Interop Library.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
how can i access the xml file in the in richtextbox in c#.net?
|
|
|
|
|
Do you want to display XML file contents to a rich text box ?
|
|
|
|
|
how to make multiline at statusbar at c#
|
|
|
|
|
I assume you mean the StatusStrip control? If so, alter the LayoutStyle property to Flow.
|
|
|
|
|
thanks for the reply and valuable solution...
now one more question.. i have two lines.. second one is only a word.. and i want that in center of the first line.. how to make that..
please reply
|
|
|
|
|
Use VerticalStackWithOverflow in the same property. It will stack every item, 1 to a line, vetically. If that's not what you need, you're gonna have to create your own control.
|
|
|
|
|
|
hi,
I'm looking for a tool that i can run to check a XML file on my sever and read the version numbers than are currently installed then if they are new to download them and install preferably by a silent install or for it to download 2 files and i will make a batch file to silently install i need it to update many applications while also checking for newly added applications also i what to run it in at the start up of my computer
PS. I'm not sure if C# is the right language but its my prefered language i can also us C++ i also tried this one http://geekswithblogs.net/arosenfeld/articles/43620.aspx[^]"> but it didn't quite work like how i what it to
thanks all
|
|
|
|
|
|