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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Dec 16, 2012, 11:16 PM EST
VulpesRank #55 · 29.2K reputationPosted Dec 16, 2012, 7:51 AM EST
and call it with your date as a string.
For example:
int number = AddDate("04/11/2008");
label1.Text = number.ToString(); // 7
shabeer shaik40 reputationPosted Dec 16, 2012, 10:39 AM EST
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
Bryian TanRank #396 · 6.3K reputationPosted Dec 16, 2012, 12:44 PM EST
shabeer shaik40 reputationPosted Dec 16, 2012, 1:17 PM EST
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 TanRank #396 · 6.3K reputationPosted Dec 16, 2012, 4:01 PM EST
shabeer shaik40 reputationPosted Dec 16, 2012, 10:58 PM EST
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
shabeer shaik40 reputationPosted Dec 16, 2012, 11:44 PM EST
Thank you ONCE AGAIN