Linggo, Enero 8, 2012

c#34 enum

sing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace WindowsFormsApplication34
{
    public partial class Form1 : Form
    {
        enum names
        {
        val,val1,val2,val3
        }
        names group = names.val;
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            textBox1.Text = group.ToString();
        }
    }
}

c#33 contructor with static2

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyClasscreated;
namespace WindowsFormsApplication33
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            class1.showmethemoney(123);
        }
    }
}
// public here is constructor here
// there are 2  public void but same can put string and int 




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace MyClasscreated
{
    class class1
    {
        string shadowcrew001;
        public class1(string name)
        {
            shadowcrew001 = name;


        }
        public string name()
        {
            return shadowcrew001;
        }
        public static void showmethemoney(string mesa)
        {
            System.Windows.Forms.MessageBox.Show(mesa);
        }
        public static void showmethemoney(int mesa)
        {
            System.Windows.Forms.MessageBox.Show(mesa.ToString());
        }
    }
}

c#32 constructor with static

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace MyClasscreated
{
    class class1
    {
        string shadowcrew001;
        public class1(string name)
        {
            shadowcrew001 = name;


        }
        public string name()
        {
            return shadowcrew001;
        }
        public static void showmethemoney(string mesa)
        {
            System.Windows.Forms.MessageBox.Show(mesa);
        }
    }
}




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyClasscreated;
namespace WindowsFormsApplication33
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            class1.showmethemoney("red horse");
        }
    }
}
// public here is constructor here

c#31 constructor

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace MyClasscreated
{
    class class1
    {
        string shadowcrew001;
        public class1(string name)
        {
            shadowcrew001 = name;
        }
       
    }
}


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MyClasscreated;
namespace WindowsFormsApplication33
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            class1 hologram = new class1("hologram");
            
        }
    }
}

c#30 adding class

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using yahoo.darkyahoo;
namespace WindowsFormsApplication32
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void Form1_Load(object sender, EventArgs e)
        {


        }
    }
}




using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace yahoo


{
    namespace darkyahoo
    {

    }
    class Class1
    {
       
    }
}
// this is for class you have create

c#29 continue and break

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace WindowsFormsApplication31
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 10; i++)
            {
                if (i == 5) continue;
                textBox1.Text += i;
            }
        }
    }
}
// but it will not include number 5

c#28 break and continue

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace WindowsFormsApplication31
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < 10; i++)
            {
                if(i == 5) break;
                textBox1.Text += i; 
            }
        }
    }
}