Click here to Skip to main content
15,884,629 members
Home / Discussions / C#
   

C#

 
QuestionC# and MS SQL DeadLock Pin
Zeyad Jalil16-Aug-16 23:41
professionalZeyad Jalil16-Aug-16 23:41 
AnswerRe: C# and MS SQL DeadLock Pin
Pete O'Hanlon17-Aug-16 0:15
mvePete O'Hanlon17-Aug-16 0:15 
AnswerRe: C# and MS SQL DeadLock Pin
Gerry Schmitz17-Aug-16 6:09
mveGerry Schmitz17-Aug-16 6:09 
AnswerRe: C# and MS SQL DeadLock Pin
Andrea Simonassi16-Sep-16 3:46
Andrea Simonassi16-Sep-16 3:46 
Questionhow to copy controls of one flowlayoutpanel to other? Pin
Le@rner16-Aug-16 20:30
Le@rner16-Aug-16 20:30 
AnswerRe: how to copy controls of one flowlayoutpanel to other? Pin
Richard MacCutchan16-Aug-16 21:22
mveRichard MacCutchan16-Aug-16 21:22 
GeneralRe: how to copy controls of one flowlayoutpanel to other? Pin
Le@rner16-Aug-16 22:30
Le@rner16-Aug-16 22:30 
GeneralRe: how to copy controls of one flowlayoutpanel to other? Pin
OriginalGriff16-Aug-16 22:55
mveOriginalGriff16-Aug-16 22:55 
A Control can only ever have one Parent: when you add it to a different Controls collection it is automatically removed from the existing collection.
If you want a visually similar control in two different places, you have to Copy it - but that means that it's a different control, any changes to one will not be reflected in the other.
To clone it isn't difficult using reflection:
C#
public static class GeneralMethods
    {
    public static T Clone<T>(this T control) where T : Control
        {
        T result = Activator.CreateInstance<T>();
        PropertyInfo[] piCollection = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
        foreach (PropertyInfo pi in piCollection)
            {
            if (pi.CanWrite)
                {
                if (pi.Name != "WindowTarget")
                    {
                    pi.SetValue(result, pi.GetValue(control, null), null);
                    }
                }
            }
        return result;
        }
    }
I suspect that you don't really want to do this - why are you trying? What are you trying to achieve? There may be a better way.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

GeneralRe: how to copy controls of one flowlayoutpanel to other? Pin
Le@rner18-Aug-16 19:02
Le@rner18-Aug-16 19:02 
QuestionC# GDI+ simulation of inclined plane Pin
Member 1268837716-Aug-16 5:59
Member 1268837716-Aug-16 5:59 
AnswerRe: C# GDI+ simulation of inclined plane Pin
OriginalGriff16-Aug-16 6:14
mveOriginalGriff16-Aug-16 6:14 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Member 1268837716-Aug-16 6:29
Member 1268837716-Aug-16 6:29 
GeneralRe: C# GDI+ simulation of inclined plane Pin
OriginalGriff16-Aug-16 6:33
mveOriginalGriff16-Aug-16 6:33 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Member 1268837716-Aug-16 7:05
Member 1268837716-Aug-16 7:05 
GeneralRe: C# GDI+ simulation of inclined plane Pin
OriginalGriff16-Aug-16 8:00
mveOriginalGriff16-Aug-16 8:00 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Member 1268837716-Aug-16 8:10
Member 1268837716-Aug-16 8:10 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Member 1268837716-Aug-16 8:18
Member 1268837716-Aug-16 8:18 
GeneralRe: C# GDI+ simulation of inclined plane Pin
OriginalGriff16-Aug-16 8:35
mveOriginalGriff16-Aug-16 8:35 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Member 1268837716-Aug-16 9:05
Member 1268837716-Aug-16 9:05 
GeneralRe: C# GDI+ simulation of inclined plane Pin
OriginalGriff16-Aug-16 9:22
mveOriginalGriff16-Aug-16 9:22 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Member 1268837717-Aug-16 0:58
Member 1268837717-Aug-16 0:58 
GeneralRe: C# GDI+ simulation of inclined plane Pin
OriginalGriff17-Aug-16 1:35
mveOriginalGriff17-Aug-16 1:35 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Mycroft Holmes16-Aug-16 14:26
professionalMycroft Holmes16-Aug-16 14:26 
GeneralRe: C# GDI+ simulation of inclined plane Pin
Gerry Schmitz16-Aug-16 6:42
mveGerry Schmitz16-Aug-16 6:42 
AnswerRe: C# GDI+ simulation of inclined plane Pin
Gerry Schmitz16-Aug-16 6:30
mveGerry Schmitz16-Aug-16 6:30 

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.