combobox

How to populate a combobox from a Access dataset / Database

ぃ、小莉子 提交于 2020-01-25 07:14:40
问题 ive hit a brick wall on what to do next to populate a combobox from a data set currently i have. my database is call "PID2db.mdb" and the table is called "Customer" string strCon = Properties.Settings.Default.PID2dbConnectionString; OleDbConnection conn = new OleDbConnection(strCon); try { conn.Open(); string strSql = "Select forename,surname from customer where [customerID] ='" + txtName.Text + "'"; OleDbDataAdapter adapter = new OleDbDataAdapter(new OleDbCommand(strSql, conn)); DataSet ds =

Error 3421 Data Type Connection Error Multy Column Combobox

断了今生、忘了曾经 提交于 2020-01-25 06:57:07
问题 I have a scenario where in I have to save "STATUS" code into table from a "COMBO BOX". This Combo Box shows "Status ID" and "Status Description" together. But while saving I need to save only "Status ID" Following is the code for the complete form functionality. Error is occurring on click of "SAVE" button. On line where I am assigning the value from combo to "Recordset Column" on line # 77 or 90. ' rs![status_ID] = Me.cboStatus.Column(1) Option Compare Database Option Explicit Dim db As

comboBox width depending on longest item

有些话、适合烂在心里 提交于 2020-01-25 04:48:50
问题 i've got a ComboBox that i generate dynamically and fill with some items. i would like to set this control's width to the width of the longest item. how do i count the display width of some text? edit: i'm using windows forms, but i would like to do it in asp.net as well 回答1: Depends. Are you using ASP.NET or Windows Forms or WPF? Are you using a fixed-width or proportional font? If you're using Windows Forms, you will want to call MeasureString() in order to find out how wide you want the

set combobox dropdown as dynamic range of values

我的梦境 提交于 2020-01-24 20:56:07
问题 Last time I asked about this I got given a solution that worked but I can no longer get that code to run. before I tried this: Set cell vlookup value based on changing Combobox value Sub DropDown7_Change() Application.ScreenUpdating = False Dim vlook_val As String Dim v_table_array As Range 'Dim totals_sheet As Worksheet Dim col_index As Integer Dim col_index_1 As Integer Dim result As Variant Dim result_1 As Variant Dim list_val As Long list_val = Worksheets("front page").Shapes("Drop Down 7

WPF ComboBox dropdown is preventing clicking other controls

你说的曾经没有我的故事 提交于 2020-01-24 20:16:15
问题 I have a simple form like this: I open the combobox and at the time dropdown is open, I click the button. On button click I show a simple message but the message is not shown at that time. It shows when I click it again. The same problem for textbox. When the dropdown is open, the textbox click is not working. Why does combobox prevent clicking other controls when it is open? 回答1: You can create an event for ComboBox DropDownClosed and with the hittestfunction, find the other control that the

WPF ComboBox dropdown is preventing clicking other controls

限于喜欢 提交于 2020-01-24 20:13:07
问题 I have a simple form like this: I open the combobox and at the time dropdown is open, I click the button. On button click I show a simple message but the message is not shown at that time. It shows when I click it again. The same problem for textbox. When the dropdown is open, the textbox click is not working. Why does combobox prevent clicking other controls when it is open? 回答1: You can create an event for ComboBox DropDownClosed and with the hittestfunction, find the other control that the

Tcl/Tk LstBox width in CombBox

流过昼夜 提交于 2020-01-24 18:17:07
问题 How can I configure the listbox component width in a combobox, so that it will fit to longest entry? The widget width itself (the entry component) can be short, but I'm looking for a way to configure the listbox component to be wider than the entry... 回答1: This is possible, but not without a bit of hacking ;) You can find the implementation of combobox in combobox.tcl (in my case /usr/share/tcltk/tk8.5/ttk/combobox.tcl . There you see that if you have a combobox set cb [ttk::combobox .cb

Get selected Object from Combobox

戏子无情 提交于 2020-01-24 14:16:05
问题 I have this Combobox filled with objects And Upon selecting a certain object from the combobox I would like to show Text in a Textbox , but for some reason I can't get my selection through. This is what is in my combobox : private void showBirds() { cboBirds.Items.Clear(); foreach (Bird b in Bird.ReadBirdCSV(txtFile.Text)) { cboBirds.Items.Add(b); } } It basically shows the names of birds from the Objects Bird. private void cboBirds_SelectionChanged(object sender, SelectionChangedEventArgs e)

Changing the style of a Combo-Box in WPF (in Blend preferably)

落爺英雄遲暮 提交于 2020-01-24 14:07:44
问题 I'm having some issues trying to change the look / style of a combo box in Expression Blend / WPF. While there are tutorials out there describing setting styles for buttons, there seem to be a few wrinkles with ComboBox controls. Can anyone offer any advice, or point me towards good tutorials that cover re-styling something more complex than a button? 回答1: The ComboBox style template has 3 parts to it. The ContentPresenter you should have come across styling Buttons. There is a Part_Popup

Have a clickable button on top of a combobox in WPF

倖福魔咒の 提交于 2020-01-24 09:59:26
问题 I can get a button to appear and be clickable in the drop down list of a combo box, but I cannot get the selected combo box item (the drop list is closed) to have the button be clickable. It always skips the button click and just opens the drop down list. I basically want the Button_Click event handler that I setup to be called once it is clicked. Here is my sample combo box that shows the button but is not clickable once it is in the selected item: <ComboBox x:Name="MyCombo" Width="200"