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;
using Microsoft;
using Microsoft.Win32;
using System.Runtime.InteropServices;


namespace Process
{



    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }

        [DllImport("Regedit.dll")]//声明DLL
        public static extern string GetRegedit(string File);//声明DLL函数,获取指定注册项内容
        [DllImport("Regedit.dll")]//声明DLL
        public static extern bool REGRegedit(string File, string Text);//声明DLL函数,写指定注册项内容

        private void button2_Click(object sender, EventArgs e)
        {
            bool VALL;
            VALL = REGRegedit("SOFTWARE/OneChina/Operation", textBox1.Text);//写指定注册项内容
            MessageBox.Show(VALL.ToString());
        }

        private void button4_Click(object sender, EventArgs e)
        {
            string VALL;
            VALL = GetRegedit("SOFTWARE/OneChina/Operation");//获取指定注册项内容
            MessageBox.Show(VALL);
        }
        private void Form1_Load(object sender, EventArgs e)
        {

            //清空所有项  
            listBox1.Items.Clear();  
            listBox1.Items.Add("111111");
            listBox1.Items.Add("222222");
            listBox1.Items.Add("333333");
        }
  
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            
            if(listBox1.Items.Count>0) 
            {
                //if (GetList(this.listBox1.SelectedItem.ToString()) != false)
                //{
                    checkedListBox1.Items.Add(this.listBox1.SelectedItem.ToString());
                //}
            } 
            
        }


        //public bool GetList(string Text)
        //{
        //    bool Dates;
        //    Dates = true;
        //    for (int i = 1; i <= checkedListBox1.Items.Count; i++)

        //        this.checkedListBox1.SelectedIndex = this.checkedListBox1.SelectedIndex + 1;
        //    string vall;
        //    vall = this.checkedListBox1.SelectedValue.ToString();
        //    if (vall == Text)
        //    {
        //        Dates = true;
        //    }
        //    else
        //    {
        //        Dates = false;
        //    }
        //    return Dates;
        //}

        private void button1_Click(object sender, EventArgs e)
        {
            string[] array;
            string a="a|b|c|d|e";
            array=a.Split('|');
            MessageBox.Show(array[0]);
            MessageBox.Show(array[1]);
            MessageBox.Show(array[2]);
            MessageBox.Show(array[3]);
            MessageBox.Show(array[4]);
            
        }

        private void button3_Click(object sender, EventArgs e)
        {
            string output = string.Empty; 
            for (int i = 0; i < checkedListBox1.CheckedIndices.Count; i++) 
            { 
               if( i+1 == checkedListBox1.CheckedIndices.Count)
               {
                    output += checkedListBox1.Items[checkedListBox1.CheckedIndices[i]].ToString(); 
               }
               else
               {
                   output += checkedListBox1.Items[checkedListBox1.CheckedIndices[i]].ToString() + "|"; 
               }
            }
            textBox1.Text = output;
         
        }

        private void button5_Click(object sender, EventArgs e)
        {
            comboBox1.Items.Clear(); 
            string[] array;
            string a ;
            a = GetRegedit("SOFTWARE/OneChina/Operation");

            MessageBox.Show(a);
            array = a.Split('|');
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] != "?")
                {
                    comboBox1.Items.Add(array[i]);
                }
            }

            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
            a = "";
        }

        

       



        }
    }
       



  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

拾荒网络工作室

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值