Click here to Skip to main content
15,867,308 members
Home / Discussions / C#
   

C#

 
QuestionStatusBar Color Change ???? Pin
Krishna Varadharajan5-Aug-10 20:48
Krishna Varadharajan5-Aug-10 20:48 
AnswerRe: StatusBar Color Change ???? Pin
Rajesh Anuhya5-Aug-10 21:03
professionalRajesh Anuhya5-Aug-10 21:03 
QuestionIs there any technique available for copying one object of class A to another object of class B ? Pin
Nadia Monalisa5-Aug-10 14:26
Nadia Monalisa5-Aug-10 14:26 
AnswerRe: Is there any technique available for copying one object of class A to another object of class B ? [modified] Pin
nlarson115-Aug-10 14:57
nlarson115-Aug-10 14:57 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Nadia Monalisa5-Aug-10 15:14
Nadia Monalisa5-Aug-10 15:14 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
nlarson115-Aug-10 16:18
nlarson115-Aug-10 16:18 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Nadia Monalisa5-Aug-10 16:22
Nadia Monalisa5-Aug-10 16:22 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
nlarson115-Aug-10 16:50
nlarson115-Aug-10 16:50 
Forgive...i'm a lowly VB programmer and i just quickly threw this together - so translate it and it should do what your looking for

Imports System.Reflection

Public Class Form1
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim a As New TheFromClass With {.Hello = "hello there", .Name = "myclass"}
        Dim b As New TheToClass With {.GoodBye = "later dude", .Hello = "wuzup"}

        Dim ta As Type = GetType(TheFromClass)
        Dim tb As Type = GetType(TheToClass)

        Dim obj As Object, PropertyName As String, ToPI As PropertyInfo = Nothing

        MsgBox(b.Hello)

        For Each FromPI As PropertyInfo In ta.GetProperties
            PropertyName = FromPI.Name
            obj = FromPI.GetValue(a, Nothing)

            ToPI = tb.GetProperties.Where(Function(p) p.Name = PropertyName).FirstOrDefault

            If ToPI IsNot Nothing Then ToPI.SetValue(b, obj, Nothing)
        Next

        MsgBox(b.Hello)

        End
    End Sub
End Class

Public Class TheFromClass
    Public Property Hello As String
    Public Property Name As String
End Class

Public Class TheToClass
    Public Property GoodBye As String
    Public Property Hello As String
End Class

'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous

GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Nadia Monalisa5-Aug-10 16:58
Nadia Monalisa5-Aug-10 16:58 
AnswerRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Giorgi Dalakishvili5-Aug-10 20:27
mentorGiorgi Dalakishvili5-Aug-10 20:27 
AnswerRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Bernhard Hiller5-Aug-10 20:33
Bernhard Hiller5-Aug-10 20:33 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? [modified] Pin
Nadia Monalisa5-Aug-10 20:41
Nadia Monalisa5-Aug-10 20:41 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
PIEBALDconsult7-Aug-10 4:21
mvePIEBALDconsult7-Aug-10 4:21 
GeneralRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
il_manti3-Nov-10 23:36
il_manti3-Nov-10 23:36 
AnswerRe: Is there any technique available for copying one object of class A to another object of class B ? Pin
Łukasz Nowakowski5-Aug-10 21:41
Łukasz Nowakowski5-Aug-10 21:41 
QuestionBest Way to Go About Updating Forms When A Piece of Data Is Changed Pin
Matt U.5-Aug-10 11:44
Matt U.5-Aug-10 11:44 
AnswerRe: Best Way to Go About Updating Forms When A Piece of Data Is Changed Pin
Chris Trelawny-Ross9-Aug-10 8:23
Chris Trelawny-Ross9-Aug-10 8:23 
QuestionInterface Events Pin
Ian Grech5-Aug-10 10:52
Ian Grech5-Aug-10 10:52 
AnswerRe: Interface Events Pin
PIEBALDconsult5-Aug-10 16:56
mvePIEBALDconsult5-Aug-10 16:56 
AnswerRe: Interface Events Pin
Chris Trelawny-Ross9-Aug-10 8:53
Chris Trelawny-Ross9-Aug-10 8:53 
GeneralRe: Interface Events Pin
Ian Grech13-Aug-10 0:34
Ian Grech13-Aug-10 0:34 
QuestionEfficient way to create a bitmap from a stream of bits in a file Pin
Adam Covitch5-Aug-10 10:50
Adam Covitch5-Aug-10 10:50 
AnswerRe: Efficient way to create a bitmap from a stream of bits in a file Pin
Eddy Vluggen5-Aug-10 11:31
professionalEddy Vluggen5-Aug-10 11:31 
AnswerRe: Efficient way to create a bitmap from a stream of bits in a file Pin
harold aptroot5-Aug-10 11:43
harold aptroot5-Aug-10 11:43 
AnswerRe: Efficient way to create a bitmap from a stream of bits in a file [modified] Pin
Luc Pattyn5-Aug-10 12:03
sitebuilderLuc Pattyn5-Aug-10 12:03 

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.