|
The exception type that you see is dependant upon HOW you are catching your exception. For example:
...
catch ( Exception ex )
will catch your exception and downcast it to the System.Exception. But if you did this:
...
catch ( SpecificTypeException ex )
then you would not be downcasting it. However your caught exception should also be of type SpecificTypeException unless the catch logic in the framework is mangling it.
|
|
|
|
|
I'm not sure I'm following you. Going up the callstack prior to the switch between the static data acess class and the main app the following code will evaluate the if statement as true of the original exeception was one of hte types being checked.
catch (Exception ex)
{
if (ex is System.Xml.XmlException || ex is System.Xml.Schema.XmlSchemaException)
{
int i = 5;
throw;
}
}
Experimentally I added catch ( System.Xml.XmlException ex) and catch (System.Xml.Schema.XmlSchemaException ex) blocks in front of the catch (Exception ex) blocks at each level of the call tree.
I continue to see the same behavior I described in my original post. One thing I forgot to mention then, at the same time I go from the static class to the main app, I get a VS unhandled exception dialog with the full exception data and break/continue/ignore(disabled)/help buttons.
|
|
|
|
|
If I understand what you are saying,
You see an exception occur in the static class.
You then see the VS dialog.
You then see the second catch and it is now a System.Exception.
Is that correct? If so, then maybe VS is getting in the way of the type.
|
|
|
|
|
hi all i have a question over here regarding entry points..
my actual question is i have linked up 2 forms together..the code is actually from two separate projects..the pro now is when i wanna debug my soln i get this error msg--"...has more than 1 entry point defined"
static void main()
{
Application.Run(new frmTest());
}
i try delete the above code from the 2nd form but it cant work.. wht am i supposed to do to ensure when im linked to the second link my application will run smoothly??
detailed help with codes posted will b greatly appreciated as im new to c# but im willing to learn
thanks
|
|
|
|
|
You can only have 1 active project, and in this project you can only have 1 Main() method.
Use "Find in files..." to find "main" method.
|
|
|
|
|
Hi everybody,
How can I make a column invisble in a DataGrid or how can I give a value to each row besides what is written in it.
Thanks,
Oren
|
|
|
|
|
|
THANKS!!!
That is perfectly what I needed.
Thank you Ankita.
|
|
|
|
|
HI, I am new to c# programming. How can I get a simple menu system? I am using visual c# 2005. I only want a print, new document, open docunment, save document and help button, how can I do this. Thank you in advance.
|
|
|
|
|
1. Add ToolStripContainer (from Toolbox) to your form.
2. Set toolStripContainer.Dock = All.
3. Add MenuStrip (from Toolbox) to the top of the toolStripContainer.
4. Select menuStrip and type captions for your menu items.
5. Select menu item and add handler to its Click event.
6. Repeat step 5 for all menu items.
|
|
|
|
|
using System;
class test
{
private static int add(int x,int y)
{
return x+y;
}
public int calling(int x, int y)
{
int k;
test obj=new test();
k=obj.add(x,y);
return k;
}
}
class now
{
public static void Main()
{
int sum,x,y;
Console.WriteLine("enter x -->> ");
x=int.Parse(Console.ReadLine());
Console.WriteLine("enter y -->> ");
y=int.Parse(Console.ReadLine());
test obj1=new test();
sum=obj1.calling(x,y);
Console.WriteLine("the value is --> {0}",sum);
}
}
|
|
|
|
|
Define "not working."
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
1. You don't need to create an instance of class test to use the add function, since add is a static function.
int sum = test.add(1, 7);
If the add function was not a static function, you would need to create an instance of test:
test myTest = new test();
int sum = myTest.add(1, 7);
2. the way you have it coded, the calling function is useless. You may have intended to make calling static, not add.
Review static objects in classes.
|
|
|
|
|
the method add and the entry point method main() are in different classes so an object will be required to call add. not exactly an object but add will be called using the class name instead of the object name. further the add is a private method and it is being called through the public method calling. now method calling is also in a different class from the class in which entry point is. now to use calling we have to create an object but it is not working. i don't know why. please look at it once more.
|
|
|
|
|
It doesn't work because you're calling static method add() using object instance. You needn't create object to call add() method:
public int calling(int x, int y)
{
return add(x,y);
}
And you even needn't create object to sum up your numbers:
public static void Main()
{
Console.WriteLine("enter x -->> ");
int x = int.Parse(Console.ReadLine());
Console.WriteLine("enter y -->> ");
int y = int.Parse(Console.ReadLine());
int sum = test.add(x,y);
Console.WriteLine("the value is --> {0}",sum);
}
|
|
|
|
|
Hello, I'm implementing drag drop functionality from a RichTextBox to a TextBox (Works Perfect!!!) When I make RichTextBox read only it doesnot work. Its my requirement to set the RichTextBox to be read only.
Any Clue???
Thanks in Advance,
Best Regards,
Rizwan Ahmed.
|
|
|
|
|
What is the syntax to embed a dictionary within another dictionary?
Dictionary<string, string=""> dicText = new Dictionary<string, string="">();
|
|
|
|
|
Umm, how about this:
Dictionary<string, Dictionary<string, MyClass>> dict = new Dictionary<string, Dictionary<string, MyClass>>();
Logifusion[^]
|
|
|
|
|
thanks dude. got this far, but now how do i insert into the 1st and 2nd respectively?
dict.add("afdfs", ?)
|
|
|
|
|
Well, in the embedded one you have to create a dictionary.
dict.Add("key1", new Dictionary<string, myclass="">());
dict["key1"].Add("key2", new MyClass(1234));</string,>
Logifusion[^]
|
|
|
|
|
don't worry I know how to do it.
dict.add("asdfad", dicC.add("asdsfa","asdf") thanks anyway
|
|
|
|
|
Hi everybody, I need to use two buttons in one DataGrid.
How can I give to each one a specific action to do?
Anybody has an idea?
Thanks,
Oren,
|
|
|
|
|
U must add to template buttons
and than add the events for them
|
|
|
|
|
I'm trying to use DLL created in visualC#.net2005 in Crystal Report ...
How can i do that ?
thanks for help
bebo
|
|
|
|
|
CSAML - Finally things are going to get easier!
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|