-
Nov 19th, 2000, 04:45 PM
#1
Thread Starter
Hyperactive Member
I have this code piece to try and convert a month in numbers to the actual month like 11/ would be november. But I get a blank msgbox when I try this code and I can not figure out why! thanks for any help!
Dim strdate As String
Dim strmonth As String
Dim theday As String
Dim str2 As String
Dim strday As String
Dim chkmonth As String
strdate = Text1.Text
If Left$(strdate, 3) = "/" Then
Select Case Mid(Text1.Text, 1, 2)
Case "10"
str2 = "October"
Case "11"
str2 = "November"
Case "12"
str2 = "December"
End Select
strmonth = str2
End If
MsgBox strmonth
Matt
-
Nov 19th, 2000, 05:23 PM
#2
Hyperactive Member
well the proble might lie in either ur if statement or at the end
If Left$(strdate, 3) = "/" Then
Select Case Mid(Text1.Text, 1, 2)
Case "10"
str2 = "October"
Case "11"
str2 = "November"
Case "12"
str2 = "December"
End Select
strmonth = str2
End If
MsgBox strmonth
that last line is saying that if the months don't fall between oct or dec then give a message box of strmonth ...
but no where on ur code is strmonth set to anything ...
maybe u meant to put: msgbox str2 ???
-
Nov 19th, 2000, 05:26 PM
#3
Lively Member
The reason it was showing nothing was because left$ was returning "dd/" and not just /.
The code below works
Dim temp As String
strdate = Text1.Text
temp = Mid(strdate, 4, 2) ' Starts at position 4 in the
' string and returns the next 2
' chars i.e mm out of dd/mm/yy
Select Case temp
Case "10"
str2 = "October"
Case "11"
str2 = "November"
Case "12"
str2 = "December"
End Select
strmonth = str2
MsgBox strmonth
Hope it helps
H.
Just trying to muddle through...
-
Nov 19th, 2000, 05:42 PM
#4
transcendental analytic
How about monthname function? It even returns the name in your language you've set on your comp:
Code:
Msgbox monthname(month(strdate ))
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.
-
Nov 19th, 2000, 05:44 PM
#5
Thread Starter
Hyperactive Member
Thanks everyone I now can make this function shorter and actually work!
Matt
-
Nov 19th, 2000, 05:47 PM
#6
_______
<?>
Code:
'easier this way.
Private Sub Command1_Click()
MsgBox Format(Text1.Text, "mmmm")
End Sub
Private Sub Form_Load()
Text1 = "2000/11/19"
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|