Where is the Visual Basic 6 Combo Box Click Event? - combobox

I'm new to Visual Basic, I have scoured the net to look for the event handler for the combo box click event but I cannot locate it. I am trying to make an event happens if a certain index is selected with the combo box1 then another combo box2 will populate the selected the index.
i have looked at links like these but it does not explain how or what the person did to access the _ click event VB6 Combo box events

In the code window for the form, select the desired control from the left drop down, then the event you want from the list of all events in the right drop down:
It will create the procedure for you and make it the active one. This is the same as VB.NET assuming you have the selectors on.

I haven't been using VB6 for ages, but i think what you need is covered here: http://www.vb6.us/tutorials/visual-basic-combo-box-tutorial
I cannot recall having to do anything special when using click events in VB6 at all.
In the first combobox click event, you should be able to have an if statement checking if a certain item is selected using .ListIndex and if so, populate the other.

Related

Combobox List passing string

I have a VB6 application that has been running for quite sometime. Currently I'm trying to update one of the form that has a combobox 2.0. Because the combobox is populated with hundreds of items - I'm trying to update it so that users are able to click on a look up button next to it, where another window opens up with all the items from the combobox. User will be able to search by keyword and/or select an item and double click on it and have it appear in the combobox. The issue I'm having is with trying to pass no value or "" when CANCEL is clicked. I'm able to pass the value if I in the properties window my STYLE Is set to COMBO rather than list. However, the issue I come across is that with COMBO the value (text) in the combobox sometimes is not aligned properly. Is there a way to pass a "" value to a combobox 2.0 without changing the style to COMBO?
If they hit cancel set the ListIndex of your combo to -1 rather than setting the text property. This is the value for no item being selected.

Multi select treeview that supports drag of multiple Items in WPF

I was searching for possible solution for hours and could not find any.
Hopefully someone can help me.
I managed to implement Multi Select WPF TreeView using the following answer: https://stackoverflow.com/a/6681993/1679059
It works nicely but I want to be able to drag selected items and drop them into the DataGrid.
In PreviewMouseMove event handler previously selected items get deselected so I can't prevent that from happening.
I was trying to prevent deselecting items in PreviewMouseLeftButtonDown event handler but at that point I cannot know if a user intends to select an item or drag selected items.
Can someone help me with that problem?
you can do this by adding a bool variable let say 'isLeftClick' in MouseLeftButton Event change isLeftClick to 'TRUE' and in MouseMove event check if isLeftClick is true or false if it is true then user thn user is trying to drag.
also check if mouse is pointed on one of selected nodes thn drag those nodes if it is on some unselected node then select that node and drag it.

WPF trigger code behind button to display second form

I am a WPF novice.
I have created a form containing a combo box with which to choose a multi-field key value(populated from an XML data file).
I have also created a second WPF form which is available to display all field values from the record associated with the multi-field key value chosen from the first form.
I need to be able to click a button which will cause the second form to be displayed, with all fields filled in which are associated with the chosen key field values.
How do I go about writing such an event trigger using C#?
couple of steps (this is not really MVVM, BTW) ...
first, add a click handler to your button
second, in the click handler code, instantiate your new form
third, set the data context, etc for the new form
forth, show the new form by calling .Show()
in your xaml add a click handler to the button in question....
<Button Click="myClickHandler"/>
in visual studio, you can right click the text in the click="" and choose to navigate to the handler and visual studio will generate the code for it for you.
in your click handler, in code behind, do something like this....
public void myClickHandler(object sender,EventArgs)
{
MySecondForm form = new MySecondForm();
form.DataContext = theDataContextIWantToSet;
form.Show();
}

silverlight combobox - highlight a few items in the popup list

I'm wondering if I can make fake sections in the popup menu:
The rule would be, if the 5th character of the displayed item is different from the 5th char of the previous item in the menu, it has to be highlighted
What do you think?
Thanks!
To achieve this would be a hack.
Normally the items that appear in the popup part of a combo box will be an instantiated data template, and each gets its own data item and has no clue or knowledge of the other items in the list, so you couldn't use a converter or anything else to achieve this behavior.
What you could do though is inject (attach) your own control into the popup part of the combo box, and take over the rendering of the data items. How you do this will depend upon which combo box you are using (i.e. MS or some other vendor's) and would be a whole new question.
Would that be easier if I were to create my own combobox as follow:
a TextBox associated with a Button that when pushed would popup a datagrid in which I could implement this conditional formatting?

Problem with combobox dropdown

I have a problem regarding combobox dropdown. Once a dropdown is opened, if I want to move focus to other control (say a textbox), I need to click twice because on first click, the combo dropdown is closed and then on second click, the textbox gets focus. How should I fix this? Please help.
You could listen to the DropDownList.SelectedIndexChanged event, and in the event handler set focus to the next control, either by setting TextBox.Focus(), or by calling System.Windows.Forms.Control.SelectNextControl()
I think this would be 'non standard' behaviour for what its worth. Its quite normal to expect the user to tab or select the next control after using a drop down.
Edit: Sorry, in a WPF ComboBox the equivalent event is SelectionChanged, but on reflection you'd be better using OnDropDownClosed. This would mean you only move the focus specifically after using the drop down rather than just whenever the value changes.

Resources