17 Aralık 2010 Cuma

C# PictureBox Image Changed

http://vbcity.com/forums/t/150005.aspx

http://www.codeproject.com/Messages/3182303/Re-Image-Changed-in-PictureBox-Event-Question.aspx

http://www.switchonthecode.com/tutorials/csharp-snippet-tutorial-custom-event-handlers

http://www.ahmetkaymaz.com/2007/09/05/delegeler-ve-olaylar-delegates-and-events-ii/

http://www.csharp-station.com/Articles/EventHandlingInCSharp.aspx

http://www.csharpnedir.com/articles/read/?filter=popular&author=&cat=&id=747&title=C

http://www.techotopia.com/index.php/C_Sharp_Events_and_Event_Parameters

http://www.ndemir.com/_net/dot-net-c-sharp/c-events-olaylar#more-2106

http://msdn.microsoft.com/en-us/library/aa645739(v=vs.71).aspx

http://www.enginpolat.com/csharp-event-firlatmak-icin-yeni-bir-yontem/

http://www.codeproject.com/KB/cs/csevents01.aspx


C# Web Service File Transfer

http://articles.techrepublic.com.com/5100-10878_11-5805105.html

using System;
using System.Web.Services;
using System.Xml.Serialization;
using System.IO;

[WebService(Namespace="http://someplace.com/FileIO/")]
public class FileRW : WebService {

    [WebMethod]
    public byte[] GetFile(string filename) {
        BinaryReader binReader = new
 BinaryReader(File.Open(Server.MapPath(filename), FileMode.Open,
 FileAccess.Read));
        binReader.BaseStream.Position = 0;
        byte[] binFile =
 binReader.ReadBytes(Convert.ToInt32(binReader.BaseStream.Length));
        binReader.Close();
        return binFile;
    }

    [WebMethod]
    public void PutFile(byte[] buffer, string filename) {
        BinaryWriter binWriter = new
 BinaryWriter(File.Open(Server.MapPath(filename), FileMode.CreateNew,
 FileAccess.ReadWrite));
        binWriter.Write(buffer);
        binWriter.Close();
    }
}

16 Aralık 2010 Perşembe

C# TextBox Databindings

Bir de textbox'a kod ile atama yapınca property bundan etkilenmiyordu.
Etkilenmesi için birşey yapmak gerekiyordu.
Bilen varsa hayrına yazıversin.

namespace WindowsApplication1
{
// simple form with one textbox and one button
    public partial class Form1 : Form
    {
        RichClass rc1 = new RichClass();
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            textBox1.DataBindings.Add("Text", rc1, "RichText");
        }
       
    }
    public class RichClass
    {
        private string richText;
        public RichClass()
        {
            richText = "richText";
        }
        public string RichText
        {
            get { return richText; }
            set { richText = value; }
        }

    }
}

Bir ara burayı düzenlemem lazım.

this.textBox1.DataBindings.Add("Text", t,"Data" , false, DataSourceUpdateMode.OnPropertyChanged);
            
            this.textBox1.DataBindings.Add("Text", t, "Data");
            this.textBox1.Text = "dddd";
            this.textBox1.BindingContext[t].EndCurrentEdit();