简体   繁体   中英

Using comboboxes for choises VB

I have created my own database and now I want data to appear in comboboxes. The combobox selections shall be guiding towards the final value.

So I manage to populate my first combobox using click assignments in Visual Studios. However, now I need to populate a second combobox using the choice of the first combobox as a filter.

I'm very new in VB and was guided to Visual Studios, but I feel that I don't even find where the population of the first combobox takes place. There's a piece of code saying

    Me.Table1BindingSource.DataMember = "Table1"
    Me.Table1BindingSource.DataSource = Me.DataBasDataSet
    Me.Table1TableAdapter.Fill(Me.DataBasDataSet.Table1)
    Me.ComboBox1.DataSource = Me.Table1BindingSource
    Me.ComboBox1.DisplayMember = "Production Technology"
    Me.ComboBox1.FormattingEnabled = True
    Me.ComboBox1.Location = New System.Drawing.Point(265, 67)
    Me.ComboBox1.Name = "ComboBox1"
    Me.ComboBox1.Size = New System.Drawing.Size(317, 21)
    Me.ComboBox1.TabIndex = 29
    Me.ComboBox1.ValueMember = "Production Technology"

which I guess uses the SQL code for Table1 that is defined is some graphical interface.. but it looks like : (SELECT DISTINCT [Production Technology] FROM [Table]).

Now, the thing is that Table, contains my whole database, including a lot of duplicate [Production Technology] and [Reactor Type]. So now I want some way to read the selected choise in ComboBox1 (which should be ComboBox1.SelectedValue?) and create a Table2 with all [Reactor Type] that also has the same value for [Production Technology] which was chosen in ComboBox1.

Is my question understanable? One of my difficulties is that some of the code is made by coding, while some weird stuff which I don\\t even understand is autogenerated with clicks... So I can't even show you the code I have, since I don't find it :S

ComboBox1 is populated by the line Me.ComboBox1.DataSource = Me.Table1BindingSource

The values that will be shown in ComboBox1 are determined by the line Me.ComboBox1.ValueMember = "Production Technology"

The selected Value is chosen in the line Me.ComboBox1.ValueMember = "Production Technology"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM