2 Attachment(s)
[RESOLVED] Astrological Calculations
Attachment 30457
Attachment 30459
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
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
'
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?
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
Re: Astrological Calculations
Quote:
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"
Re: Astrological Calculations
Quote:
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
Re: [RESOLVED] Astrological Calculations
Peter _B --> Thanks for the correction!
Halosar7 ---> The correction apply only for Capricorn, the other remain the same
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.
Re: [RESOLVED] Astrological Calculations
Post all your procedure code
Re: [RESOLVED] Astrological Calculations
Quote:
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"
Re: [RESOLVED] Astrological Calculations
Quote:
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"?
Re: [RESOLVED] Astrological Calculations
What's the wrong result? In which sign? in which dates' range?
Quote:
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
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" ?
Re: [RESOLVED] Astrological Calculations
Quote:
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
Re: [RESOLVED] Astrological Calculations
Now i understand :-) Thanks you :-)