从零开始学习C#

来源:互联网 发布:sql 字段内容替换 编辑:程序博客网 时间:2024/05/21 21:03

     做了3年多的abaper,没有其他语言的开发经验,现在公司项目上要做个.NET windows应用程序与SAP做接口,今天翻了翻4年前在武汉上学时候买的《C#入门经典》,觉得C#也不是那么难,应该很快可以搞定这个接口。

 

     下边是windows 应用程序小例子:

 

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

namespace WindowsApplication1
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            ((Button)sender).Text = "Clicked";
            Button newButton = new Button();
            newButton.Text = "New button";
            newButton.Click += new EventHandler(newButton_Click);
            Controls.Add(newButton);
        }
        private void newButton_Click(object sender, System.EventArgs e)
        {
            ((Button)sender).Text = "Clicked";
           
        }

    }
}

原创粉丝点击