Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个小应用程序来验证我们的测试报告。这将从 .rtf 文件中读取值并将所需的值上传到数据库中。现在我有一个小问题。我需要从数据库中读取一些字段并将它们加载到组合框中。我写了一个小函数
public void loadfromDB() { <Logic here }
我有 Program.cs 文件,我从中调用 Application.run(new frmMain)。
现在我必须在我的应用程序开始时调用我的函数。这个怎么做。我刚开始学习c#。
您需要双击表单(从设计视图),以便它显示 Form1_Load 事件,如:
private void Form1_Load(object sender, EventArgs e) { // You can call any of your functions loadfromDB(); } public void loadfromDB() { // Logic here }