Click here to Skip to main content
15,906,569 members
Home / Discussions / C#
   

C#

 
GeneralRe: Effective Security Access Check Pin
martin_hughes26-Dec-07 2:11
martin_hughes26-Dec-07 2:11 
GeneralRe: Effective Security Access Check Pin
Jeffrey Walton28-Dec-07 8:08
Jeffrey Walton28-Dec-07 8:08 
GeneralRe: Effective Security Access Check [modified] Pin
martin_hughes28-Dec-07 9:28
martin_hughes28-Dec-07 9:28 
GeneralI ate too much... and another nice C# 3.0 feature Pin
martin_hughes25-Dec-07 6:17
martin_hughes25-Dec-07 6:17 
GeneralRe: I ate too much... and another nice C# 3.0 feature Pin
Jeffrey Walton25-Dec-07 7:39
Jeffrey Walton25-Dec-07 7:39 
GeneralRe: I ate too much... and another nice C# 3.0 feature Pin
martin_hughes25-Dec-07 7:50
martin_hughes25-Dec-07 7:50 
GeneralRe: I ate too much... and another nice C# 3.0 feature Pin
Waleed Eissa25-Dec-07 17:09
Waleed Eissa25-Dec-07 17:09 
GeneralRe: I ate too much... and another nice C# 3.0 feature Pin
martin_hughes26-Dec-07 2:28
martin_hughes26-Dec-07 2:28 
GeneralExercise Solution Pin
Kefaleas Stavros24-Dec-07 23:52
Kefaleas Stavros24-Dec-07 23:52 
GeneralRe: Exercise Solution Pin
Luc Pattyn25-Dec-07 0:58
sitebuilderLuc Pattyn25-Dec-07 0:58 
GeneralA simple paint program-C# Pin
Ali Rahimei24-Dec-07 22:48
Ali Rahimei24-Dec-07 22:48 
GeneralRe: A simple paint program-C# Pin
Luc Pattyn25-Dec-07 1:00
sitebuilderLuc Pattyn25-Dec-07 1:00 
GeneralRe: A simple paint program-C# Pin
Paul Conrad25-Dec-07 10:33
professionalPaul Conrad25-Dec-07 10:33 
GeneralA simple paint program-C# Pin
Ali Rahimei24-Dec-07 22:46
Ali Rahimei24-Dec-07 22:46 
GeneralRe: A simple paint program-C# Pin
Giorgi Dalakishvili24-Dec-07 23:03
mentorGiorgi Dalakishvili24-Dec-07 23:03 
QuestionHow i can user User Control in my own Form Pin
wasimsharp24-Dec-07 21:23
wasimsharp24-Dec-07 21:23 
AnswerRe: How i can user User Control in my own Form Pin
Xmen Real 25-Dec-07 2:53
professional Xmen Real 25-Dec-07 2:53 
GeneralRe: How i can user User Control in my own Form Pin
wasimsharp25-Dec-07 19:33
wasimsharp25-Dec-07 19:33 
GeneralRe: How i can user User Control in my own Form Pin
Xmen Real 26-Dec-07 0:40
professional Xmen Real 26-Dec-07 0:40 
GeneralPrint Screen Pin
half-life24-Dec-07 20:19
half-life24-Dec-07 20:19 
GeneralRe: Print Screen Pin
Giorgi Dalakishvili24-Dec-07 20:24
mentorGiorgi Dalakishvili24-Dec-07 20:24 
GeneralSystem.ArgumentException Assistance Needed... [modified] Pin
new_phoenix24-Dec-07 13:38
new_phoenix24-Dec-07 13:38 
Hello, guys!!

I am working with an application that uses a try-catch block inside a DragOver Event handler. The problem is that there is an Argument Exception that occurs when a control is dragged. Technically, it is a circular reference. When this Argument Exception occurs, both controls disappear, and the ArgumentException handler catches the error. The question is, how do I get the Exception handlers to prevent the code from running, thereby preventing the controls from disappearing? Is there a way of trapping the condition that causes the ArgumentException so that the controls would not disappear because of the error?

Here is the code:

private static void _ctrlParent_DragOver(object sender, DragEventArgs e)
{
    try
    {
        if (DragDropHandler.CanDropHere((Control)sender, e.Data))
        {
            // Control dragged to
            Control cthis = (Control)sender;
            // Control dragged
            CardControl ctrl = (CardControl)DragDropHandler.GetControl(e.Data, true, true);
            e.Effect = DragDropEffects.Move;

            if (!(ctrl is IDragDropEnabled))
            {
                return;
            }
            if (cthis.Name != ctrl.Name)
            {
                if ((ctrl.HasChildren == false) && (ctrl.blnCardFaceStatus==true)
                    || ((ctrl.HasChildren == true) && (ctrl.blnCardFaceStatus=true)))
                {
                    //MessageBox.Show("cthis is " + cthis.Name + " and ctrl is " + ctrl.Name);
                    ctrl.Parent.Controls.Remove(ctrl);
                    ctrl.Parent = cthis;   // Here is where the circular reference occurs.
                    cthis.Controls.Add(ctrl);
                    ctrl.BringToFront();
                }
                else if ((ctrl.HasChildren == true) && (ctrl.blnCardFaceStatus==false)
                    || ((ctrl.HasChildren == false) && (ctrl.blnCardFaceStatus=false)))
                {
                    return;
                }
            }
            else
            {
                return;
            }
            Point NewLocation = cthis.PointToClient(new Point(e.X, e.Y));
            ctrl.Left = NewLocation.X - dragPoint.X;
            ctrl.Top = NewLocation.Y - dragPoint.Y;
        }
        else
        {
            e.Effect = DragDropEffects.None;
        }
    }
    catch (System.ArgumentException)
    {
        MessageBox.Show("Argument Exception Error");
    }
}


modified on Monday, December 24, 2007 8:12:20 PM

QuestionExcel to XML converter with VC# [modified] Pin
iyepb024-Dec-07 10:03
iyepb024-Dec-07 10:03 
GeneralRe: Excel to XML converter with VC# Pin
Ed.Poore25-Dec-07 14:35
Ed.Poore25-Dec-07 14:35 
GeneralRe: Excel to XML converter with VC# Pin
Waleed Eissa25-Dec-07 17:52
Waleed Eissa25-Dec-07 17:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.