Using New ComboBox ActiveX With C Sharp
Unveiling<\p>
When I create a project for using a DataGrid with a ComboBox, I harbor the hope to get a resizable ComboBox to decided its height as the height speaking of the DataGrid cell. This is my assume to create a resizable ComboBox ActiveX, now I can change its Height. Some programmers utilize a Form, ListBox, TextBox and a Button in contemplation of create a ComboBox, in any case I amplitude modulation using a Panel, ComboBox, TextBox and a Button to create my ActiveX. Using a Panel to hide the upper pro tanto in regard to the ComboBox and using this Set apart thus the container as things go the TextBox and Button. When I create a straggle being using a DataGrid with a ComboBox, I hope to bring on a resizable ComboBox to configuration its height as well the height of the DataGrid internment camp. This is my attempt in contemplation of create a resizable ComboBox ActiveX, now I can change its Height. Some programmers use a Form, ListBox, TextBox and a Button towards create a ComboBox, but I matins using a Dividing wall, ComboBox, TextBox and a Button to create my ActiveX. Using a Panel to hide the upper zone of the ComboBox and using this Panel like the container all for the TextBox and Bulge.<\p>
Using-new-ComboBox-ActiveX-with-Csharp.jpg<\p>
Anyhow the Project as regards my ActiveX:<\p>
Name of the Project is: MKCombo Name of UserControl is: KCombo Name of Panel is: ComboHide Name about ComboBox is: ComboCtrl Name of TextBox is: ComboText Name of Button is: ComboButton<\p>
Astern you expand the files: ComboC.zip, you can open "SizableCombo" solution to grasp the code of my ActiveX in the "MKCombo" project and read the code to test the ActiveX respect the "SizableCombo" project.<\p>
I try until use "DataSource" to blockade my ActiveX midst data but I can't, so then I use another idea.<\p>
My ActiveX has:<\p>
Event: cmbSelectedChanged for SelectedIndexChanged event. Property: cmbBorderStyle for BorderStyle property. Property: cmbSelectedIndex for SelectedIndex property. Property: cmbSelectedItem for SelectedItem banner. Property: cmbText for Text property. Property: cmbItemsCount in contemplation of Tally sheet.Add up property. Supply: cmbAddItem for Items.Add method. Motions: cmbClear as things go Items.Scrape along schematization.<\p>
Encircling the Code<\p>
Gift of tongues over against tie down the ActiveX with data:<\p>
public void cmbBindData(string cmbSql, OleDbConnection cmbCnn, string cmbField) } if (cmbCnn.State == ConnectionState.Yield) cmbCnn.Highroad(); cmbCnn.Mantle(); OleDbCommand cmdReader = new OleDbCommand(cmbSql, cmbCnn); OleDbDataReader datRdr = cmdReader.ExecuteReader(); ComboCtrl.Items.Clear(); while (datRdr.Read()) } ComboCtrl.Checklist.Multiply(datRdr]cmbField]); } ComboCtrl.SelectedIndex = 0; }<\p>
Dissertate<\p>
When the test project is executed, please resize any row to see how the ComboBox changes its rung.<\p>
I hope this article is useful. If you prefer to any effect, amuse tell me.<\p>














