-
October 7th, 2012, 02:55 PM
#1
[RESOLVED] Astrological Calculations
Witch code must be writen in order to show this:
Already i have 8 textbox, 1 label and1 command button. I add second label and name itZdate. Now i want when i put number in days and months field on Zdate label it show zodiac name. For example:
Code:
If Text5, text6, text7, text8 = "from 03 - 21 to 04-20" then
Zdate.caption = "Aries"
Else
EndIf
End Sub
I hope you understand what i wanna to do
Zodiac date table:
Aries - 03.21-04.20
Ox - 04.21-05.21
Twin - 05.22-0621
Cancer - 06.22-07.22
Lion - 07.22-08.22
Virgo - 08.23-09.23
Libra - 09.24-10.23
Scorpion -10.24-11.22
Sagittarius - 11.23-12.22
Capricorn - 12.23-01.19
Aquarius- 01.20-02.18
Fish - 02.19-03.20
-
October 7th, 2012, 06:14 PM
#2
Re: Astrological Calculations
After the line : "Label1.Caption = Format(intTotal2)" and before the line: "Else"Write the next lines of code
Code:
Dim strAux as String
strAux = Text5.Text & Text6.Text & Text7.Text & Text8.Text
If strAux >= "0321" And strAux <= "0420" Then SDate.Caption = "Aries"
If strAux >= "0421" And strAux <= "0521" Then SDate.Caption = "Ox"
If strAux >= "0522" And strAux <= "0621" Then SDate.Caption = "Twin"
'
' And So on each zodiac name
'
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
October 8th, 2012, 04:12 AM
#3
Re: Astrological Calculations
Thanks you really match You are pro on this vb6 programming. I wonder whats you learning process must be so you can programming like this. How you study vb6?
-
October 8th, 2012, 09:45 AM
#4
Re: [RESOLVED] Astrological Calculations
I'm glad to help you
You are begining to learn so your threads are elemental level as mine hehehe
I'm in the programming languages and systems development world since 1977 and still learning
I participate in some forums to practice my english skills
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
October 8th, 2012, 10:17 AM
#5
Re: Astrological Calculations
Originally Posted by jggtz
After the line : " Label1.Caption = Format(intTotal2)" and before the line: "Else"Write the next lines of code
Code:
Dim strAux as String
strAux = Text5.Text & Text6.Text & Text7.Text & Text8.Text
If strAux >= "0321" And strAux <= "0420" Then SDate.Caption = "Aries"
If strAux >= "0421" And strAux <= "0521" Then SDate.Caption = "Ox"
If strAux >= "0522" And strAux <= "0621" Then SDate.Caption = "Twin"
'
' And So on each zodiac name
'
This pattern works (assuming that the leading zeroes are always present in Text5 and Text7) for all except 'Capricorn', as the dates for that span the end of the year.
Following the pattern would give:
Code:
If strAux >= "1223" And strAux <= "0119" Then SDate.Caption = "Capricorn"
which will obviously not be satisfied for any value of strAux. In this case you will need to use Or instead:
Code:
If strAux >= "1223" Or strAux <= "0119" Then SDate.Caption = "Capricorn"
-
October 8th, 2012, 10:31 AM
#6
Re: Astrological Calculations
Originally Posted by Peter_B
This pattern works (assuming that the leading zeroes are always present in Text5 and Text7) for all except 'Capricorn', as the dates for that span the end of the year.
Following the pattern would give:
Code:
If strAux >= "1223" And strAux <= "0119" Then SDate.Caption = "Capricorn"
which will obviously not be satisfied for any value of strAux. In this case you will need to use Or instead:
Code:
If strAux >= "1223" Or strAux <= "0119" Then SDate.Caption = "Capricorn"
So basically i need just change text from AND to OR. Thanks you :-)
I just tried to did this what you suggest, it not going to work, it make calculation discrepancies
Last edited by Halosar7; October 8th, 2012 at 10:37 AM.
-
October 8th, 2012, 10:47 AM
#7
Re: [RESOLVED] Astrological Calculations
Peter _B --> Thanks for the correction!
Halosar7 ---> The correction apply only for Capricorn, the other remain the same
Last edited by jggtz; October 8th, 2012 at 10:50 AM.
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
October 8th, 2012, 10:56 AM
#8
Re: [RESOLVED] Astrological Calculations
Code:
If strAux >= "1123" And strAux <= "1222" Then SDate.Caption = "Šaulys"
If strAux >= "1223" Or strAux <= "0119" Then SDate.Caption = "Ožiaragis"
If strAux >= "0120" And strAux <= "0218" Then SDate.Caption = "Vandenis"
If strAux >= "0219" And strAux <= "0320" Then SDate.Caption = "Žuvys"
But this correction did affect progams funcionality? Because Aquarius and fish remains same and that "or" intervened in the middle.
-
October 8th, 2012, 11:03 AM
#9
Re: [RESOLVED] Astrological Calculations
Post all your procedure code
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
October 8th, 2012, 11:06 AM
#10
Re: [RESOLVED] Astrological Calculations
Originally Posted by jggtz
Post all your procedure code
Code:
If strAux >= "0321" And strAux <= "0420" Then SDate.Caption = "Avinas"
If strAux >= "0421" And strAux <= "0521" Then SDate.Caption = "Jautis"
If strAux >= "0522" And strAux <= "0621" Then SDate.Caption = "Dvynys"
If strAux >= "0622" And strAux <= "0722" Then SDate.Caption = "Vėžys"
If strAux >= "0722" And strAux <= "0822" Then SDate.Caption = "Liūtas"
If strAux >= "0823" And strAux <= "0923" Then SDate.Caption = "Mergelė"
If strAux >= "0924" And strAux <= "1023" Then SDate.Caption = "Svarstyklės"
If strAux >= "1024" And strAux <= "1122" Then SDate.Caption = "Skorpionas"
If strAux >= "1123" And strAux <= "1222" Then SDate.Caption = "Šaulys"
If strAux >= "1223" Or strAux <= "0119" Then SDate.Caption = "Ožiaragis"
If strAux >= "0120" And strAux <= "0218" Then SDate.Caption = "Vandenis"
If strAux >= "0219" And strAux <= "0320" Then SDate.Caption = "Žuvys"
-
October 8th, 2012, 11:18 AM
#11
Re: [RESOLVED] Astrological Calculations
Originally Posted by Halosar7
Code:
If strAux >= "0321" And strAux <= "0420" Then SDate.Caption = "Avinas"
If strAux >= "0421" And strAux <= "0521" Then SDate.Caption = "Jautis"
If strAux >= "0522" And strAux <= "0621" Then SDate.Caption = "Dvynys"
If strAux >= "0622" And strAux <= "0722" Then SDate.Caption = "Vėžys"
If strAux >= "0722" And strAux <= "0822" Then SDate.Caption = "Liūtas"
If strAux >= "0823" And strAux <= "0923" Then SDate.Caption = "Mergelė"
If strAux >= "0924" And strAux <= "1023" Then SDate.Caption = "Svarstyklės"
If strAux >= "1024" And strAux <= "1122" Then SDate.Caption = "Skorpionas"
If strAux >= "1123" And strAux <= "1222" Then SDate.Caption = "Šaulys"
If strAux >= "1223" Or strAux <= "0119" Then SDate.Caption = "Ožiaragis"
If strAux >= "0120" And strAux <= "0218" Then SDate.Caption = "Vandenis"
If strAux >= "0219" And strAux <= "0320" Then SDate.Caption = "Žuvys"
Looks OK to me. What value of strAux does it not work for?
Edit: Are you sure that strAux has the leading zeroes correctly? I.e. is the first of january "0101" rather than "11"?
-
October 8th, 2012, 11:18 AM
#12
Re: [RESOLVED] Astrological Calculations
What's the wrong result? In which sign? in which dates' range?
But this correction did affect progams funcionality? Because Aquarius and fish remains same and that "or" intervened in the middle
In this case there is not important the order of the instructions
JG
... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...
-
October 8th, 2012, 11:25 AM
#13
Re: [RESOLVED] Astrological Calculations
Program works fine for now. But i dont understand why only capricorn must be with "OR" and other remains same as "AND" ?
-
October 8th, 2012, 11:33 AM
#14
Re: [RESOLVED] Astrological Calculations
Originally Posted by Halosar7
Program works fine for now. But i dont understand why only capricorn must be with "OR" and other remains same as "AND" ?
I explained this in my first post - it is because Capricorn spans dates from the end of one year into the start of the next. Therefore the 'start' date (23rd December) is later in the year than the 'end' date (19th January).
For all the other signs the 'start' date is earlier in the year than the 'end' date
-
October 8th, 2012, 11:39 AM
#15
Re: [RESOLVED] Astrological Calculations
Now i understand :-) Thanks you :-)
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
|