سلام دوستان
من اين كد برنامه وي بي رو دارم بايد تا 4 بهمن به پاسكال تبديلش كنم ....... كمك
ايميل من [email protected]
من اين كد برنامه وي بي رو دارم بايد تا 4 بهمن به پاسكال تبديلش كنم ....... كمك
کد:
Dim Leap As Byte
Dim Crist_Months(1 To 12) As Integer
Dim SolHej_Months(1 To 12) As Integer
Dim Crist_Year, Crist_Month, Crist_Day As Integer
Dim SolHej_Year, SolHej_Month, SolHej_Day As Integer
Sub init()
Dim i As Integer
Crist_Months(1) = 31
Crist_Months(2) = 28
Crist_Months(3) = 31
Crist_Months(4) = 30
Crist_Months(5) = 31
Crist_Months(6) = 30
Crist_Months(7) = 31
Crist_Months(8) = 31
Crist_Months(9) = 30
Crist_Months(10) = 31
Crist_Months(11) = 30
Crist_Months(12) = 31
SolHej_Months(1) = 31
SolHej_Months(2) = 31
SolHej_Months(3) = 31
SolHej_Months(4) = 31
SolHej_Months(5) = 31
SolHej_Months(6) = 31
SolHej_Months(7) = 30
SolHej_Months(8) = 30
SolHej_Months(9) = 30
SolHej_Months(10) = 30
SolHej_Months(11) = 30
SolHej_Months(12) = 29
End Sub
Function IsCristLeap(ByVal Year As Integer) As Byte
If Year Mod 4 = 0 Then
IsCristLeap = 1
Else
IsCristLeap = 0
End If
End Function
Function IsSolHejLeap(ByVal Year As Integer) As Byte
Dim Temp As Long
Temp = Year + 38
Temp = Temp * 31
Temp = Temp Mod 128
If (Temp > 30) Then
IsSolHejLeap = 0
Else
IsSolHejLeap = 1
End If
End Function
Function CYearToSHYear(ByVal CYear As Integer) As Integer
CYearToSHYear = CYear - 622
End Function
Function NOfCristDay(CMonth, CDay As Integer) As Integer
Dim NoDays, i As Integer
NoDays = CDay
If CMonth >= 3 Then
NoDays = NoDays + Leap
End If
For i = 1 To CMonth - 1
NoDays = NoDays + Crist_Months(i)
Next i
NOfCristDay = NoDays
End Function
Sub ComputeSHMD2(ByRef CristDays As Integer)
Dim Temp As Integer
Temp = CristDays \ 31
If Temp <= 5 Then
SolHej_Month = Temp + 1
SolHej_Day = CristDays Mod 31
If SolHej_Day = 0 Then
SolHej_Month = Temp
SolHej_Day = 31
End If
Else
CristDays = CristDays - (6 * 31)
If CristDays = 0 Then
SolHej_Month = 6
SolHej_Day = 31
Else
Temp = CristDays \ 30
SolHej_Month = 6 + Temp + 1
CristDays = CristDays - ((Temp) * 30)
SolHej_Day = CristDays Mod 30
If SolHej_Day = 0 Then
SolHej_Month = 6 + Temp
SolHej_Day = 30
End If
End If
End If
End Sub
Sub ComputeSHMD(ByRef CristDays As Integer)
Dim PYearLeap, SHYearLeap As Byte
PYearLeap = IsCristLeap(Crist_Year - 1)
If CristDays <= 20 - PYearLeap Then
SolHej_Month = 10
SolHej_Day = 10 + PYearLeap + CristDays
Else
CristDays = CristDays - 20 + PYearLeap
If CristDays <= 30 Then
SolHej_Month = 11
SolHej_Day = CristDays
Else
CristDays = CristDays - 30
SHYearLeap = IsSolHejLeap(SolHej_Year)
If CristDays <= 29 + SHYearLeap Then
SolHej_Month = 12
SolHej_Day = CristDays
Else
CristDays = CristDays - (29 + SHYearLeap)
SolHej_Year = SolHej_Year + 1
ComputeSHMD2 (CristDays)
End If
End If
End If
End Sub
Function MtoS(ByVal mdate As String) As String
Dim CristDays As Integer
init
Crist_Year = Val(Mid(mdate, 1, 4))
Crist_Month = Val(Mid(mdate, 6, 2))
Crist_Day = Val(Mid(mdate, 9, 2))
Leap = IsCristLeap(Crist_Year)
SolHej_Year = CYearToSHYear(Crist_Year)
CristDays = NOfCristDay(Crist_Month, Crist_Day)
ComputeSHMD (CristDays)
If (SolHej_Month = 2 Or 4 Or 6) And (SolHej_Day >= 29) Then
MtoS = Trim(Str(SolHej_Year)) + "/" + Format(Trim(Str(SolHej_Month)), "00") + "/" + Trim(Str(SolHej_Day))
Else
MtoS = Format(Str(SolHej_Year) + "/" + Str(SolHej_Month) + "/" + Str(SolHej_Day), "yyyy/mm/dd")
End If
End Function
Function sdate() As String
Dim mdate As String
init
mdate = Format(Date, "yyyy/mm/dd")
sdate = MtoS(mdate)
End Function
Private Sub cmdGenerate_Click()
Text1 = sdate()
End Sub
ايميل من [email protected]