기타 [vb.net] 클래스에서 이벤트 매인 폼에서 사용하기
페이지 정보
본문
Public Class program1472
Public Event program1472_LOG(ByVal sender As Object, ByVal e As String, ByVal IS_BLANK_LINE As Boolean)
Private WithEvents WORK As System.Windows.Forms.Timer
Private Sub LOG(ByVal value As String, Optional ByVal IS_BLANK_LINE As Boolean = False)
Dim T As String = String.Format("[{0}-{1}-{2}] {3}", _nhnID, _ORDER_INDEX, _WORK_INDEX, value)
RaiseEvent program1472_LOG(Me, T, IS_BLANK_LINE)
End Sub
Private Sub WORK_Tick(sender As Object, e As EventArgs) Handles WORK.Tick
WORK.Stop()
'// 중략
_STATUS = False
LOG("작업을 마무리합니다.", True)
End Sub
Private _STATUS As Boolean
Public Property STATUS() As Boolean
Get
Return _STATUS
End Get
Set(value As Boolean)
_STATUS = value
End Set
End Property
Public Sub START_WORK()
_STATUS = True
WORK = New System.Windows.Forms.Timer
WORK.Interval = 100
WORK.Enabled = _STATUS
End Sub
Private _nhnPW As String
Public Property nhnPW() As String
Get
Return _nhnPW
End Get
Set(value As String)
_nhnPW = value
End Set
End Property
Private _ORDER_INDEX As Integer
Public Property ORDER_INDEX() As Integer
Get
Return _ORDER_INDEX
End Get
Set(value As Integer)
_ORDER_INDEX = value
End Set
End Property
Private _WORK_INDEX As Integer
Public Property WORK_INDEX() As Integer
Get
Return _WORK_INDEX
End Get
Set(value As Integer)
_WORK_INDEX = value
End Set
End Property
End Class
Public Class Main
Private Sub program1472_LOG(ByVal sender As Object, ByVal e As String, ByVal IS_BLANK_LINE As Boolean)
LOG(e, IS_BLANK_LINE)
Dim C As program1472 = CType(sender, program1472)
If Not C.STATUS Then Work.Start()
End Sub
Dim WB As program1472
Private Sub Work_Tick(sender As Object, e As EventArgs) Handles Work.Tick
Work.Stop()
'// 중략
WB = New program1472
AddHandler WB.program1472_LOG, AddressOf program1472_LOG
'// 중략
End Sub
End Class
- 이전글[vb.net] Http 비동기 샘플 : 비동기 및 대기를 사용한 비동기 프로그래밍 20.05.25
- 다음글[vb.net] html 테그를 클립보드에 삽입하는 함수 20.05.23
댓글목록
등록된 댓글이 없습니다.