04/11/2008 = 4+1+1+2+0+0+8=16 =1+6=7
15/11/2012= 1+5+1+1+2+0+1+2=13 =1+3=4
How do i do this in visual syudio 2008
please help
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Dec 17, 2012, 4:16 AM
shabeer shaikPosted Dec 17, 2012, 4:44 AM
Thank you ONCE AGAIN
shabeer shaikPosted Dec 17, 2012, 3:58 AM
i have a label on form 2 called label1. it inherits the day from form1 when the user selects a date from datepicker1.
on form2 i have a textbox3. i want to take the label1.text which for example is SATURDAY.
EACH LETTER FROM SATURDAY HAS A VALUE IN ARRAY. FOR EXAMPLE S=2,A=1,T=3,U=1 ETC
SATURDAY WILL THEN BE 2+1+3..= 22
I MANAGED TO GET TO THE ANSWER OF 22. NOW I NEED TO SPLIT 22 INTO 2+2=4. vULPES HAS HELP THUS FAR. HE ALSO GAVE ME A FUNCTION WHICH WORKS WITH DATE. NOW IT IS WITH DAY
Bryian TanPosted Dec 16, 2012, 9:01 PM
shabeer shaikPosted Dec 16, 2012, 6:17 PM
tell me if i can use the same function when it comes to DAYS.EXAMPLE
Saturday,Monday.etc
I am trying to use the prev solution with arrays.
I INCLUDED in my Form LOAD AN ARRAY LIKE
STRING [] DAYS = {"SATURDAY","Monday",etc ...};
WHEN I RUN THE CODE I AM GETTING 22. I NEED TO SPLIT 2+2=4 (correct)
WHEN I RUN THE CODE WITH FUNCTION i get 8(incorrect)
if(comboBox2.SelectediNDEX >1)
{
string text1 = comboBox2.SelectedItem.ToString().ToLower();
int total1 = 0;
for (int i=0; i < text1.lenght; i++)
if (dict.ContainKeys(text1 [i]))
{
total1 += dict[text1 [i]];
int s = convert.ToInt32(total1 += dict[text1 [i]]);
int number = AddDate(s.ToString());
textBox3.Text = number.ToString();
Bryian TanPosted Dec 16, 2012, 5:44 PM
shabeer shaikPosted Dec 16, 2012, 3:39 PM
how do i change the last two lines
int number = AddDate(label1.text)
textBox5 = number.ToString()
can i do it like tis or do i convertTo Int32
VulpesPosted Dec 16, 2012, 12:51 PM
and call it with your date as a string.
For example:
int number = AddDate("04/11/2008");
label1.Text = number.ToString(); // 7