クラス化
フォーム | コーディング WinMe VB6.0 sp4 |
Option Explicit Dim ClassSamp As Class1 Private Sub Form_Load() 'クラス使用宣言 Set ClassSamp = New Class1 'プロパティ:-1(前月末)、+1(翌月末)、0(当月末) ClassSamp.mflag = 0 MsgBox ClassSamp.gmatsu("2000/1/1") 'Nothingは必ず行う Set ClassSamp = Nothing End End Sub |
|
クラス | コーディング WinMe VB6.0 sp4 |
Option Explicit Private clsFlag As Integer '無理してプロパティ使ってみました(^^ゞ Public Property Let mflag(dateflg As Integer) '末日の値 clsFlag = dateflg End Property Public Function gmatsu(datedat As Date) As String Dim ansdate As Date ansdate = DateSerial(Year(datedat), Month(datedat) + clsFlag + 1, "01") ansdate = ansdate - 1 gmatsu = Format$(ansdate, "yyyy/mm/dd") End Function |