-3

i managed to do somehow what i want by doing this

    private void textBox1_Enter(object sender, EventArgs e)
    {
        textBox1.Text = "a1";
    }

But i want this to happen without clicking on the textbox The way i did upper required me to click before a1 will be written there.

4

2 に答える 2

4

Loadフォームのイベントでそれを行う必要があります

private void YourFormName_Load(object sender, EventArgs e)
{
     string someValue="Get the value from wherever you want";
     textBox1.Text = someValue;
}
于 2012-08-27T16:07:41.633 に答える
0

たとえば、 appsetting で config のグローバル変数を読み取る必要がある場合

NameValueCollection appSettings = ConfigurationManager.AppSettings;
textBox1.Text = appSettings["yourkey"];
于 2012-08-27T16:03:27.343 に答える