开发者

c# comboBox_SelectedIndexChanged

i'm working on windows form, and on that form i have a comboBox that attached to a dataBase, and several empty textBoxes that dosen't attach开发者_Python百科ed to anything... now what i want is this: when i choose a value from the comboBox then the empty textBoxes will fill with data from the dataBase... for example, if the comboBox attached to a "person" table to the "ID" column, then when i choose an ID number from the comboBox then the empty textBoxes will fill with that same person data, like age,birthDate,height exc...

i know that i'm suppose to use the function "SelectedIndexChanged", but how? if someone can help me or even post a similer example it will help alot thanks!


This sort of thing?

    private void comboName_SelectedIndexChanged(object sender, EventArgs e)
    {
        String lookupName = comboName.SelectedText;

        String id = String.Empty;
        Int32 age = 0;
        PullDataFromDatabase(lookupName, ref id, ref age);

        textID.Text = id;
        textAge.Text = age.ToString();
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜