我有一个应用程序,其中我有一个连接到datagridview的数据库,我想用ComboBox过滤这个datagridview数据库。但我无法弄清楚如何做到这一点。我试着和我的文本框一样,但是没有用:
<template name="DefaultIncrementalRefreshMessage" id="1">
<string name="ApplVerID" id="1128">
<constant value="9"/>
</string>
<string name="MessageType" id="35">
<constant value="X"/>
</string>
<string name="SenderCompID" id="49">
<constant value="MOEX"/>
</string>
<uInt32 name="MsgSeqNum" id="34"/>
<uInt64 name="SendingTime" id="52"/>
<uInt32 name="LastFragment" id="893" presence="optional"/>
<sequence name="MDEntries">
<length name="NoMDEntries" id="268"/>
<uInt32 name="MDUpdateAction" id="279"/>
<string name="MDEntryType" id="269"/>
<uInt64 name="SecurityID" id="48" presence="optional"/>
<uInt32 name="SecurityIDSource" id="22">
<constant value="8"/>
</uInt32>
<string name="Symbol" id="55" presence="optional"/>
<string name="SecurityGroup" id="1151" presence="optional"/>
<uInt32 name="ExchangeTradingSessionID" id="5842" presence="optional"/>
<uInt32 name="RptSeq" id="83"/>
<uInt32 name="MarketDepth" id="264" presence="optional"/>
<uInt32 name="MDPriceLevel" id="1023" presence="optional"/>
<int64 name="MDEntryID" id="278" presence="optional"/>
<decimal name="MDEntryPx" id="270" presence="optional"/>
<int64 name="MDEntrySize" id="271" presence="optional"/>
<uInt32 name="MDEntryDate" id="272" presence="optional"/>
<uInt32 name="MDEntryTime" id="273"/>
<int32 name="NumberOfOrders" id="346" presence="optional"/>
<string name="MDEntryTradeType" id="20003" presence="optional"/>
<int32 name="TrdType" id="828" presence="optional"/>
<decimal name="LastPx" id="31" presence="optional"/>
<int32 name="MDFlags" id="20017" presence="optional"/>
<string name="Currency" id="15" presence="optional"/>
<uInt64 name="Revision" id="20018" presence="optional"/>
<string name="OrderSide" id="10504" presence="optional"/>
</sequence>
</template>
答案 0 :(得分:0)
尝试这样(你说combobox
所以我使用了SelectionChangeCommited
),
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{
(dataGridView1.DataSource as DataTable).DefaultView.RowFilter = string.Format("Propertyname= '{0}'", comboBox1.SelectedItem.ToString());
}
您还可以查看this
希望有所帮助,