当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - How to call user defined function within main function of Windows Form Application

问题描述:

I have small application for validating our test reports. This will read the values from .rtf files and upload required values into a database. Now i have a small problem. I need to read some fields from database and load them onto a combo-box. I wrote a small function

 public void loadfromDB()

{

<Logic here

}

I have Program.cs File from which i call Application.run(new frmMain).

Now i have to call my function at the start of my application. How to do this. I have just started learning c#.

网友答案:

U need to double click on the form (from design view) so that it will show up the Form1_Load event like:

private void Form1_Load(object sender, EventArgs e)
{
 // You can call any of your functions
 loadfromDB();
}

public void loadfromDB()
{
// Logic here
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: