简体   繁体   English

使用组合框选择VB

[英]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. 因此,我设法使用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. 我在VB中是一个非常新的人,曾被引导到Visual Studio,但是我感到自己什至找不到第一个组合框的填充位置。 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]). 我猜想使用的SQL代码是为Table1定义的,它是一些图形界面。.但是它看起来像:(从[Table]选择DISTINCT [Production Technology]。

Now, the thing is that Table, contains my whole database, including a lot of duplicate [Production Technology] and [Reactor Type]. 现在,事实是Table包含了我的整个数据库,包括很多重复的[生产技术]和[反应器类型]。 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. 因此,现在我想要一种方法来读取ComboBox1中的选定选择(应该为ComboBox1.SelectedValue?),并创建一个表2,其中所有[反应器类型]的值也与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 我的困难之一是某些代码是通过编码完成的,而有些我什至不理解的怪异东西都是通过点击自动生成的...所以我什至无法向您展示我拥有的代码,因为我没有没找到它:S

ComboBox1 is populated by the line Me.ComboBox1.DataSource = Me.Table1BindingSource 由行Me.ComboBox1.DataSource = Me.Table1BindingSource填充ComboBox1。

The values that will be shown in ComboBox1 are determined by the line Me.ComboBox1.ValueMember = "Production Technology" 由行Me.ComboBox1.ValueMember = "Production Technology"确定在ComboBox1中显示的值。

The selected Value is chosen in the line Me.ComboBox1.ValueMember = "Production Technology" 在行Me.ComboBox1.ValueMember = "Production Technology"选择选定的值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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