谁可以把这个VB代码转成JAVA的 谢谢

[复制链接]
查看11 | 回复3 | 2010-9-19 17:17:04 | 显示全部楼层 |阅读模式
Dim wl, gq, xz, day As Long
Private Sub Command1_Click()
Dim aAs Long, day1, day2 As String
b = True
Text1.Text = ""
day1 = Text3.Text

day2 = Text4.Text
If day1 = "" Then Exit Sub
If day2 = "" Or Combo1.Text = "" Then MsgBox "请设定工作日": Exit Sub


a = DateDiff("d", day2, day1)
If a > 150 Then MsgBox "时间过长,请耐心等待"
If Combo1.Text = "夜班" Then
day2 = DateAdd("d", 1, day2)
ElseIf Combo1.Text = "休息1" Then
day2 = DateAdd("d", 2, day2)
ElseIf Combo1.Text = "休息2" Then
day2 = DateAdd("d", 3, day2)
End If
For i = 0 To a
Text1.Text = Text1.Text & DateAdd("D", i, Text4.Text)

a = DateDiff("d", Text4.Text, DateAdd("D", i, day2))
'a = DateDiff("d", Text4.Text, day)

a = a Mod 4

Select Case a
Case 0:Text1.Text = Text1.Text & ":早班" & vbCrLf
Case 1: Text1.Text = Text1.Text & ":夜班" & vbCrLf
Case Else: Text1.Text = Text1.Text & ":休息" & vbCrLf

End Select
Next i
End Sub
Private Sub Command2_Click()
Dim a As Long, day As String
day = Text2.Text
If Text4.Text = "" Or Combo1.Text = "" Then MsgBox "请设定工作日": Exit Sub

a = DateDiff("d", Text4.Text, day)
If Combo1.Text = "夜班" Then
a = a + 1
ElseIf Combo1.Text = "休息1" Then
a = a + 2
ElseIf Combo1.Text = "休息2" Then
a = a + 3
End If

a = a Mod 4
Select Case a
Case 0: Command2.Caption = "早班"
Case 1: Command2.Caption = "夜班"
Case Else: Command2.Caption = "休息"

End Select
End Sub
Private Sub Form_Load()
Dim a As String
Text1.Locked = True
Text4.Text = Date
Text3.Text = Date
Text2.Text = Date
Text1.Text = ""
Command1.Caption = "查询(&H)"
Command2.Caption = "查询(&H)"
Combo1.Text = "早班"
If Dir(App.Path & "\peizhi.ini") = "" Then
Open App.Path & "\peizhi.ini" For Output As #1: Close 1
Else
Open App.Path & "\peizhi.ini" For Input As #2
Do While Not EOF(2)
Line Input #2, a
If InStr(a, "[sylc]=") > 0 Then Text3.Text = Replace(a, "[sylc]=", "")
If InStr(a, "[gzr]=") > 0 Then Text4.Text = Replace(a, "[gzr]=", "")
If InStr(a, "[gzlc]=") > 0 Then Combo1.Text = Replace(a, "[gzlc]=", "")

Loop
End If
Close 2
Call Command1_Click
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim a As String
If Text3.Text = "" Or Text4.Text = "" Then Exit Sub
a = "[sylc]=" & Text3.Text & vbCrLf & "[gzr]=" & Text4.Text & vbCrLf & "[gzlc]=" & Combo1.Text _
Open App.Path & "\peizhi.ini" For Output As #1
Print #1, a
Close 1
End Sub
Private Sub Text2_GotFocus()
Command2.Caption = "查询(&H)"
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call Command2_Click
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call Command1_Click
End Sub
谁能帮帮忙啊

回复

使用道具 举报

千问 | 2010-9-19 17:17:04 | 显示全部楼层
其实完全可以,不过嫌麻烦。。
回复

使用道具 举报

千问 | 2010-9-19 17:17:04 | 显示全部楼层
不同的语言不能互相转换,即使是比尔盖茨也不会!
回复

使用道具 举报

千问 | 2010-9-19 17:17:04 | 显示全部楼层
这是一个体力活
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则