我正在使用access創建一個資料庫,突然間,當我運行代碼時,我的表單不顯示了。剛才還能顯示表單,現在就不顯示了。順便說一下,我沒有碰過或搞過program.cs檔案。 下面是program.cs檔案:
namespace P1
{
static class Program {
{
// <summary>
// 應用程式的主要入口點。
// </summary>/span>
[]
static void Main()
{
Application.EnableVisualStyles()。
Application.SetCompatibleTextRenderingDefault(false)。
Application.Run(new Form1())。
}
}
下面是我的資料庫代碼,如果有幫助的話。我甚至刪減了一些代碼,但它根本沒有顯示表單。然而,它顯示程式已經建立,沒有錯誤。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
使用System.Threading.Tasks;
namespace P1
{
public partial class Form1 : Form
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source =d:DDBS.mdb") 。
OleDbDataAdapter adap = new OleDbDataAdapter(@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source =d:DDBS.mdb","select * from Student") 。
DataTable d2 = new DataTable()。
DataSet d1 = new DataSet("Student");
public Form1()
{
InitializeComponent()。
}
private void Form1_Load(>objectsender, EventArgs e)。
{
// TODO: 這行代碼將資料加載到'dDBSDataSet.Student'表。你可以根據需要移動,或洗掉它。
//this.studentTableAdapter.Fill(this.dDBSDataSet.Student);
}
private void display_btn_Click(object sender, EventArgs e)。
{
adap.Fill(d2)。
dataGrid3.DataSource = d2;
}
private void dataGrid1_Navigate(object sender, NavigateEventArgs ne)。
{
}
private void button3_Click(object sender, e)。
{
}
private void form2_btn_Click(object sender, EventArgs e)。
{
Form2 f2 = new Form2();
f2.Show()。
}
private void button3_Click_1(object sender, EventArgs e)。
{
Form3 f3 = new Form3();
f3.Show()。
}
private void button4_Click(object sender, e)。
{
Form4 f4 = new Form4();
f4.Show();
}
private void next_btn_Click(object sender, EventArgs e)。
{
}
private void dataGrid2_Navigate(object sender, NavigateEventArgs ne)。
{
}
private void dataGrid3_Navigate(object sender, NavigateEventArgs ne)。
{
}
}
}
表格的設定輸出型別。

uj5u.com熱心網友回復:
看起來你已經評論掉了顯示表單的那一行。在你的底部示例代碼中,有一個Form1_Load方法,TODO上面的一行是你想要的行。
uj5u.com熱心網友回復:
我認為你的問題是你設定的輸出型別是控制臺應用程式或類別庫。你應該把它改為Application Form。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/309687.html
標籤:
下一篇:如何處理在其他形式下的計算欄位?
