CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Jul 2011
    Posts
    4

    RaiseEvent from VB.net to CSharp problem

    RaiseEvent from VB.net to CSharp problem

    I am converting my vb.net project to CSharp, everything work fine except the RaiseEvent. I totally have no idea how to do it, can anybody help me?
    Thank so much.

    I have a custom button control and following is part of the code:

    Code:
    Public Class EnquiryButton
        Inherits System.Windows.Forms.Button
    
        Public Event EnquiryReturned(ByVal sender As Object, ByVal e As System.EventArgs)
        Private Event ReturnObjectChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    
    
        Private Sub BindReturnObjectToTargetControl()
            ' Assign Values to Control
            If Not Me.ReturnValue_TargetControl Is Nothing Then
                CallByName(Me.ReturnValue_TargetControl, Me.ReturnValue_TargetControlPropertyName, CallType.Set, Me.ReturnObject.ReturnValue)
            End If
            If Not Me.ReturnDescription_TargetControl Is Nothing Then
                CallByName(Me.ReturnDescription_TargetControl,   Me.ReturnDescription_TargetControlPropertyName, CallType.Set, Me.ReturnObject.ReturnDescription)
            End If
    
        End Sub
    
    
        Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
            Dim retObj As Enquiry.ReturnObject = FetchReturnObject(Type)
            If Not retObj Is Nothing Then
                _ReturnObject = retObj
                OnReturnObjectChanged(System.EventArgs.Empty)
            End If
            OnEnquiryReturned(System.EventArgs.Empty)
            MyBase.OnClick(e)
        End Sub
    
    
        Protected Sub OnReturnObjectChanged(ByVal e As EventArgs)
            BindReturnObjectToTargetControl()
            RaiseEvent ReturnObjectChanged(Me, System.EventArgs.Empty)
        End Sub
    
        Protected Sub OnEnquiryReturned(ByVal e As EventArgs)
            RaiseEvent EnquiryReturned(Me, System.EventArgs.Empty)
        End Sub
    
    End Class
    Last edited by mansonho; July 11th, 2011 at 08:54 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured