0

My project is standalone application. I want to show my search result using user control window. so I added user control to my project. and I wrote code for it attached to form. It attached properly. But I want show my search result using that user control window's text box so how can i do this. Please help me in form1

tr.rtnTxtMake = text;

user control

string txtMake;

public string rtnTxtMake
{
    get { return txtMake; }
    set { txtMake = value; }
}

This is my code; how do I show this text? It's not working with txt_ree.Text = txtMake.ToString();

4

1 に答える 1

2

ユーザー コントロールにTextBox呼び出されたものがあると仮定して、次のようなプロパティを作成します。makeTextBox

public string TextMake
{
    get { return makeTextBox.Text; }
    set { makeTextBox.Text = value; }
}

これで、次のようにユーザー コントロールにテキストを割り当てることができます (それが と呼ばれると仮定しますtr)。

tr.TextMake = "some text";

プロパティを介して TextBox に直接割り当てられます。テキストを格納するローカル変数は必要ありません。

于 2012-07-14T15:38:54.973 に答える