0

ここに私が問題を抱えているフォームの1つのコード全体があります

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 MySql.Data.MySqlClient;

namespace office
{
    public partial class Form2 : Form
    {


    public Form2()
    {
        InitializeComponent();
    }

    private void pictureBox1_Click(object sender, EventArgs e)
    {
        if (Variables.lightsoff == false)
        {
            pictureBox1.Image = office.Properties.Resources.switch_off_icon;
            Variables.lightsoff = true;
        }
        else
        {
            pictureBox1.Image = office.Properties.Resources.switch_on_icon;
            Variables.lightsoff = false;
        }

    }

    private void pictureBox4_Click(object sender, EventArgs e)
    {
        if (Variables.screenoff == true)
        {
            Variables.screenoff = false;
        }
        else
        {
            Variables.screenoff = true;
        }


    }

    private void pictureBox3_Click(object sender, EventArgs e)
    {
        string path;
        OpenFileDialog file = new OpenFileDialog();
        if (file.ShowDialog() == DialogResult.OK)
        {
            path = file.FileName;
            MessageBox.Show("File has been printed!");
        }

    }

    private void checkBox1_CheckedChanged(object sender, EventArgs e)
    {
        if (checkBox1.Checked == true)
        {
            trackBar1.Visible = true;
            label9.Visible = true;

        }

    }

    private void button2_Click(object sender, EventArgs e)
    {
        this.Close();
    }

    private void pictureBox2_Click(object sender, EventArgs e)
    {

    }

    private void pictureBox5_Click(object sender, EventArgs e)
    {
        Bookstore Bookstore = new Bookstore();
        Bookstore.ShowDialog();
    }

    private void pictureBox6_Click(object sender, EventArgs e)
    {
        Buffet Buffet = new Buffet();
        Buffet.ShowDialog();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        EventsCalendar Events = new EventsCalendar();
        Events.ShowDialog();
    }

    private void button3_Click(object sender, EventArgs e)
    {

    }

    private void Form2_Load(object sender, EventArgs e)
    {
        string constring = "datasource=localhost;port=3306;username=root;password=salala;" ;
        string Query = "select * from apps.events ";
        MySqlConnection conDatabase = new MySqlConnection(constring);
        MySqlDataAdapter da = new MySqlDataAdapter(Query, conDatabase);
        conDatabase.Open();
        DataSet ds = new DataSet();
        da.Fill(ds, "select");
        DataTable dt = new DataTable();
        dt = ds.Tables["select"];
        foreach (DataRow dr in dt.Rows)
        { 
            listBox1.Items.Add(dr["event_name"].ToString() + " | " + dr["event_description"].ToString() + " | " + dr["event_date"].ToString() + " | " + dr["event_time"].ToString() + " | " + dr["event_duration"].ToString() + " | " + dr["notification_type"].ToString() + " | " + dr["event_type"].ToString());

        }

    }


}
}    

理由はわかりませんが、デバッグで機能するのはチェックボックスだけです。ピクチャボックスはどれも機能しません。データベースは正常に動作しています。助言がありますか?前もって感謝します

4

1 に答える 1

0

それは最終的にform2.designerの問題でしたが、この問題の原因はまだわかりません

于 2013-09-15T19:21:17.350 に答える