Sabtu, 11 Januari 2014

array

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 WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int[] a = new int[5];

            a[0] = 1;
            a[1] = 2;
            a[2] = 3;
            a[3] = 4;
            a[4] = 5;
           
            for (int i = 0; i < 5; i++)
            {
                listBox1.Items.Add(a[i]);
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            int[,] b = new int[2, 3];

            b[0,0] = 1;
            b[0,1] = 2;
            b[0,2] = 3;
            b[1,0] = 4;
            b[1,1] = 5;
            b[1,2] = 6;

            for (int i = 0; i < 2; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    listBox2.Items.Add(b[i, j]);
                }
            }
        }
    }
}


Jumat, 10 Januari 2014

C# Enable and Disable

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 WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label1.Enabled = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            label1.Enabled = false;
        }
    }
}
http://reionnote.wordpress.com/belajar-c-kode/belajar-c-sharp-enable-disable/

Jumat, 15 November 2013

Visible

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 sembunyiTidak
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            label1.Visible = true;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            label1.Visible = false;
        }
    }
}


Selasa, 13 Agustus 2013

hScrollBar C#

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 scroll
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }

        private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
        {
            textBox1.Text = hScrollBar1.Value.ToString();
           
        }

        private void Form1_Load(object sender, EventArgs e)
        {
           
            hScrollBar1.Maximum = 100;
            hScrollBar1.Value = 0;
            hScrollBar1.Minimum = 0;
          hScrollBar1.ValueChanged += new EventHandler(hScrollBar1_ValueChanged);
        }

        void hScrollBar1_ValueChanged(object sender, EventArgs e)
        {
            textBox2.Location = new Point(hScrollBar1.Value,64);
            //throw new NotImplementedException();
        }
    }
}


Rabu, 22 Mei 2013

pembulatan2angkaBlakangKoma


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 pembulatan2angkaBlakangKoma
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            double a, b;
            a = Convert.ToDouble(textBox1.Text);
            b = Math.Round(a, 2);
            textBox2.Text = Convert.ToString(b);
        }
    }
}

Minggu, 07 April 2013

C# Environment.NewLine

inget ganti namespace na ya.. .(back to reionnote)


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 membuatLineBaru
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            label1.Text = "ini adalah sebuah contoh program" + Environment.NewLine + " yg menjelaskan perlunya membuat line baru " + Environment.NewLine + "sehingga apa yang kita tulis " + Environment.NewLine + "tidak menghabiskan banyak tempat " + Environment.NewLine + "dan membuat bingung kita sendiri";
        }
    }
}