Jabaco Source |
|
1 2 3 4 5 6 7 |
Public Sub MonthCalendar1_Selected() MonthCalendar1.Visible = False Command1.Caption = MonthCalendar1.Calendar.getTime.toLocaleString End Sub Public Sub Command1_Click() MonthCalendar1.Visible = True End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 |
Public Sub InitDate(thisDate As Date) Dim Cal As GregorianCalendar = Cast(MyCal.clone, java#util#GregorianCalendar) Cal.set(Calendar.YEAR, Year(thisDate)) Cal.set(Calendar.MONTH, Month(thisDate)-1) Cal.set(Calendar.DAY_OF_MONTH, Day(thisDate)) InitCalendar(Cal) bInitEnd = True End Sub |
Beginner
Date of registration: Feb 27th 2014
Location: Supanburi ,Thailand
Occupation: Agric Chemical Seller
Hobbies: learning programming and English
Beginner
Date of registration: Feb 27th 2014
Location: Supanburi ,Thailand
Occupation: Agric Chemical Seller
Hobbies: learning programming and English
This post has been edited 1 times, last edit by "Theera" (Mar 10th 2014, 5:06am)
Jabaco Source |
|
1 2 |
'########################### MouseListener Public Sub mousePressed(arg2 As MouseEvent) |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
'########################### CreateControls Private Function CreateControls(ParentForm As UserControl, _ MListener As java#awt#Event#MouseListener, _ Count As Integer, _ Width As Integer, _ Height As Integer, _ pos0X As Integer, _ pos0Y As Integer, _ cxy As Integer, _ flip As Boolean) As Label() 'Creates an array of controls Dim Control As Label Dim List() As Label: ReDim List(0 To Count - 1) Dim i As Integer, L As Integer, T As Integer For i = 0 To Count - 1 Control = New Label ParentForm.add(Control) List(i) = Control Control.Parent.addMouseListener(MListener) Control.TextAlign = fmTextAlignCenter If Width > 0 Then Control.Width = Width If Height > 0 Then Control.Height = Height L = pos0x + (i Mod cxy) * Width T = pos0y + (i \ cxy) * Height If flip Then Dim tmp As Integer tmp = L: L = T: T = tmp End If Control.Left = L Control.Top = T Control.Parent.addMouseListener(MListener) Next CreateControls = List End Function |
Jabaco Source |
|
1 |
Control.Parent.addMouseListener(MListener) |
This post has been edited 1 times, last edit by "Dani" (Jul 18th 2014, 9:04pm)
Hey there,
Calendar.MONTH is zero based!!!!!!!!!!!!
So here is a working Calendar Control:
Jabaco Source |
|
1 2 3 4 5 6 7 8 |
Private Sub Command1_Click() Dim d As Date d = Now() MsgBox d & vbNewLine & _ Day(d) & " " & _ Month(d) & " " & _ Year(d) End Sub |
Source code |
|
1 2 |
19.07.2014 09:23:47 19 7 2014 |
Source code |
|
1 2 |
06.07.0024 09:26:17 6 7 24 |
Jabaco Source |
|
1 2 3 4 5 6 7 8 9 |
Public Sub InitDate(thisDate As Date) Dim Cal As GregorianCalendar = Cast(MyCal.clone, java#util#GregorianCalendar) Cal.set(Calendar.YEAR, Year(thisDate)) '############# ERROR! Cal.set(Calendar.MONTH, Month(thisDate)-1) Cal.set(Calendar.DAY_OF_MONTH, Day(thisDate)) InitCalendar(Cal) bInitEnd = True End Sub |
Jabaco Source |
|
1 2 3 4 5 6 7 8 |
Private Sub Command1_Click() Dim d As Date d = Time() MsgBox d & vbNewLine & _ Day(d) & " " & _ Month(d) & " " & _ Year(d) End Sub |
Source code |
|
1 2 |
19.07.2014 09:23:47 19 7 2014 |
You are right. Thanks to find the buggy function.by the way, the problem seems to be the Now() function:
Quoted
Time() ...
returns
Quoted
/*
Function Weekday(Date, [FirstDayOfWeek As VbDayOfWeek = vbSunday])
Function TimeValue(Time As String)
Function TimeSerial(Hour As Integer, Minute As Integer, Second As Integer)
Calendar
Date
Date$
DateAdd
DateDiff
DatePart
DateSerial
DateValue
Time
Time$
TimeSerial
*/