本文介绍了在单击添加按钮时,我希望文本框应显示????????的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows窗体上有4个值的Apple,Oranges,Kiwi和Bread combox.我想基于组合框中选择的值以相同的形式更新文本框中的代码.因此,如果Apple在组合框中被选中,则代码应用程序应显示组合框中的奇异果是否比文本框中的值是奇异,依此类推.

我已将所有数据保留在组合框中,但尚未为此创建任何数据.

1.是否必须为此创建Sql Data,然后必须进行连接?

请朋友,我没有4个项目,我还有30个数据,所以请让我知道我如何在组合框中管理此数据


================================================== ================

在单击添加按钮时,文本框应显示我编写的代码,该代码给我错误

I have combox with 4 values Apple,Oranges,Kiwi and Bread on windows form. I want to update a code in textbox on same form based on value selected in combobox. so if Apple got selected in combobox, code app should show if kiwi in combobox than value in text box is kiw and so on.

I have kept all data in combo box i have not create any data for this.

1. Do i have to create Sql Data for this and then i have to do the connection?

please friends i don''t have only 4 item i have data more the 30 so please let me know how i manage this data in combo box


==================================================================

On the click to the add button the text box should display the code which i have written it gives me error

private void button2_Click(object sender, EventArgs e)
       {
           frmsalesorderbooking f2 = new frmsalesorderbooking();
           groupBox1 gb = new GroupBox1();
           int topPosition = 5;
           for (int j = 0; j < Convert.ToInt32(textBox6.Text.ToString()); j++)
           {
               comboBox2 cb = new ComboBox1();
               cb.left = 5;
               cb.top = topPosition;
               topPosition += 30;
               gb.controls.Add(cb);
           }
           frmsalesorderbooking.Control.Add(gb);
           frmsalesorderbooking.show();
       }






在此先感谢:rose :: rose:






Thanks in Advance :rose::rose:

推荐答案

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
     {
         textBox1.Text = comboBox1.Text;
     }


Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.Text = "RED" Then
            TextBox1.Text = "RED SELECTED"
        End If
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("RED")
    End Sub



:cool :: cool :: cool :: cool :: cool :: cool:



:cool::cool::cool::cool::cool::cool:



这篇关于在单击添加按钮时,我希望文本框应显示????????的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 23:20