|
-
Oct 12th, 2000, 06:12 AM
#1
Thread Starter
Addicted Member
Hi all,
Need some help/advice on the following issue pls.
I would like to populate a combo box with value of the months.
I want the box to be populated with the month of September and October, and for the box to add the current month in automatically. i.e if I ran the app in December I would want all months from September to December to be populated in the box.
Any ideas please.
-
Oct 12th, 2000, 06:32 AM
#2
transcendental analytic
Code:
For x = 9 To Month(Now)
Combo1.AddItem x
Next x
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 12th, 2000, 07:55 AM
#3
Thread Starter
Addicted Member
Month
Thanks for the above...
I know that the month pulls out a number representing the month, can it pull out the name of the month???
thanks,
-
Oct 12th, 2000, 08:02 AM
#4
Fanatic Member
Use the MonthName function.
MsgBox MonthName(Month(Now))
[Edited by jbart on 10-12-2000 at 09:05 AM]
-
Oct 12th, 2000, 08:04 AM
#5
transcendental analytic
You would have to make an array for the results:
private monthname() as string
Code:
Monthname=Array("January", "February", .... "December")
For x = 9 To Month(Now)
Combo1.AddItem Monthname(x)
Next x
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 12th, 2000, 09:07 AM
#6
Thread Starter
Addicted Member
Hi guys,
below is a some code i was working on to compare a date with a value and pull out all dates till th ecurrent month.
what would be the correct syntax for the Next m line of code, and do you think that this will work?
Sub GetDate()
FirstDate = "01/09/2000"
m = FirstDate
Do While m <= Date
n = MonthName(m) & Year(m)
AnalystCallMonitor.cbMonthFr.AddItem n & y
Next m (((would like m to equal the next month here))))))
End Sub
thanks again all
Rocks the VB Newbie
-
Oct 12th, 2000, 09:25 AM
#7
Fanatic Member
I am not sure, but this may help. It populates a combobox with all dates from Sept 1, 2000 to the current day's date.
Code:
Private Sub Command1_Click()
Dim startDate As Date
startDate = "08/31/2000"
While startDate < Now
startDate = DateAdd("d", 1, startDate)
Combo1.AddItem startDate
Wend
End Sub
Maybe you could use something from it for the routine you are writing.
Oops, it goes through to the next day, but you can add code to stop prior to that.
(uses the North American date format: mm/dd/yy)
[Edited by jbart on 10-12-2000 at 10:28 AM]
-
Oct 12th, 2000, 09:34 AM
#8
Another question, same topic...
if after we click on the december... can we have a list of all the days in that month? just like when we click filr.. it goes down... and sometime we have choice to go left...
-
Oct 12th, 2000, 09:43 AM
#9
Fanatic Member
For i = 9 To Month(Now)
Combo1.AddItem MonthName(i)
Next
-
Oct 12th, 2000, 10:43 AM
#10
transcendental analytic
[code]
for i=1 to datediff("d",cdate("01/" & month(now)),cdate("01/" & month(now)+1 ))
list2.additem i
next i
[/code}
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 12th, 2000, 10:56 AM
#11
Fanatic Member
Dragonyian,
The following code uses two combo boxes. Select a month from the first one and the second one shows all days for that month.
Not real pretty, but it works. Perhaps you can modify it for your use.
Code:
Option Explicit
Private Sub Form_Load()
Combo1.AddItem "January"
Combo1.AddItem "February"
Combo1.AddItem "March"
Combo1.AddItem "April"
Combo1.AddItem "May"
Combo1.AddItem "June"
Combo1.AddItem "July"
Combo1.AddItem "August"
Combo1.AddItem "September"
Combo1.AddItem "October"
Combo1.AddItem "November"
Combo1.AddItem "December"
End Sub
Private Sub Combo1_Click()
Dim selMonth As Integer
Dim startDate As Date
Dim endDate As Date
Dim yearCheck As Integer
selMonth = Combo1.ListIndex + 1
Combo2.Clear
startDate = Str(selMonth) & "/01/" & Str(Year(Now))
If selMonth <> 12 Then
yearCheck = Str(Year(Now))
Else
yearCheck = Str(Year(Now) + 1)
selMonth = "0"
End If
endDate = Str(selMonth + 1) & "/01/" & yearCheck
startDate = DateAdd("d", -1, startDate)
endDate = DateAdd("d", -1, endDate)
While startDate < endDate
startDate = DateAdd("d", 1, startDate)
Combo2.AddItem startDate
Wend
End Sub
-
Oct 12th, 2000, 11:12 AM
#12
Hi there: I know what you are saying, thanks for the reply... But it doesn't look VERY GOOD ... but i try to use a pop up menu, still doesn't look good..... thinking if i can make it like menu bar.....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|