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
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 ...
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?
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 ...
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"
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.
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.
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"
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"?
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
Bookmarks