12 23 3456 456 comboboxA comboboxB 1234567890 12 2345678901 23 3456789012 3456 4567890123 456Hi All,ComboBoxA change event to display comboboxB values filter by starting letters loading from two different tables.Pls help me.table1DigitalCode1234567890234567890134567890124567890123table2dgGrp12233456456comboboxA comboboxB1234567890 122345678901 233456789012 34564567890123 456推荐答案好吧,从我可以推断出你想做的事情我会使用以下内容:Well, from what I can deduce you wanna do I would use the following:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace TestApp{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private string[] table2 = new string[] { "12", "23", "3456", "456" }; private void comboBoxA_SelectedIndexChanged(object sender, EventArgs e) { // Find filter char char selectedChar = comboBoxA.Text[0]; // Clear combo box comboBoxB.SelectedIndex = -1; comboBoxB.Items.Clear(); // Repopulate by selected char for (int i = 0; i < table2.Length; i++) { if (table2[i][0] == selectedChar) { comboBoxB.Items.Add(table2[i]); } } } }} 这篇关于组合框A到组合框B过滤起始字符从组合框A到组合框B匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-24 01:42