How to Link the index of two listbox in VB6 - listbox

Is there a way to link the index of two listboxes? For example, I have 2 listboxes and I want to delete a value in the 1st listbox and have the second listbox delete the same index as the 1st listbox.

You will have something like below...
Private Sub Command1_Click()
Dim xRemove As Integer
xRemove = List1.ListIndex
List2.ListIndex = xRemove
List2.RemoveItem xRemove
End Sub

Related

Tabulator - how to call a function when using the built in "list" editor and selecting a list option

I'm new to Tabulator. When using the built in list editor on a column, how would I call a function when one of the list items is selected and get the value of the newly selected list item? I've tried cellClick but it calls the function before I can select an item and cellEdited doesn't fire when the item is selected. Any ideas? Thanks!
Here is the column setup:
{title:"Status", field:"status", editor:"list", editorParams:{values:{"Active":"Active", "Won":"Won", "Lost":"Lost", "Cancelled":"Cancelled"}},cellEdited:function(e, cell){CallSomeFunction(cell);}

How to define the columns in CRUD grid?

I need to define which columns shall appear and their order in the CRUD grid.
If I use crud.getGrid().setColumns(...) then the edit column does not appear. If I include vaadin-crud-edit-column in the list then I get an exception cause this column does not exist (but I see it there!).
If I remove the un-needed columns (lot of trouble anyway!) I still can't change the column sequence.
Is there some way to sort this out?
For adding edit column to the Grid in Crud there is a helper method Crud.addEditColumn(grid) You can also use this method to add your edit column as a first column or last column depending how you configure the Grid.
private void customGrid() {
Grid<Person> grid = new Grid<>(Person.class);
Crud<Person> crud = new Crud<>(Person.class, grid, createPersonEditor());
PersonDataProvider dataProvider = new PersonDataProvider();
crud.setDataProvider(dataProvider);
grid.setColumns("firstName","lastName");
Crud.addEditColumn(grid);
add(crud);
}

How to get objective choice field selected index in Blackberry

I have to display items in objective choice Field,based on selected value i have to display another objective choice field how can i do that.How to get selected index value in objective choice field in blackberry.
Thank You
Say you have an ObjectChoiceField myCombo;
which have values from an array.
String myValues [] = {"a","b","c"};
myCombo.setChoices(myValues);
you can get the selected index by using method:
int index = myCombo.getSelectedIndex();
and further if you want the selected value. You would use something like:
String selectedValue = myValues[myCombo.getSelectedIndex()];
See documentation for further reference.

Show tooltip in dropdownlist items mouseover event

I have one database with three columns named id.name, mobile_no.
I want to display mobile no as tooltip in dropdownlist items. Dropdownlist item showing name.
Tooltip showing mobile number which is in database so fetch from database.
How it is?
Since you talk about a dropdownlist, I'm assuming this is ASP.NET. Here's how:
Private Sub loadDropDown
Dim personDataTable As DataTable
Dim personDataRow As DataRow
Dim personListItem As ListItem
' Data access stuff to get data from DB goes here
For Each personDataRow In personDataTable.Rows
personListItem = New ListItem
With personListItem
.Text = personDataRow.Item("Name").ToString
.Value = personDataRow.Item("Id").ToString
.Attributes.Add("title", personDataRow.Item("mobile_no").ToString)
End With
PeopleDropDownList.Items.Add(personListItem)
Next
End Sub

ASP.NET MVC using UpdateModel to post child records

Continuing from this question, I've got a form with all the Vehicles listed for a Person, the vehicle fields are editable, and they are now successfully posting back to my Save action.
Now I'd like to use UpdateModel to save the data, but I'm not sure how to construct it. Here's my Save action right now:
<ActionName("Edit"), AcceptVerbs(HttpVerbs.Post)> _
Function Save(ByVal form As Person, ByVal vehicles() As Vehicle) As ActionResult
Dim original = From v In MyDataContext.Vehicles Where v.person_id = Person.person_id
For Each item In original
For i = 0 To vehicles.Count - 1
If vehicles(i).vehicle_id = item.vehicle_id Then
UpdateModel(item, New String() {"license_nbr", "color"})
Exit For
End If
Next
Next
MyDataContext.SubmitChanges()
Return RedirectToAction("Index", "Home")
End Function
When I run this, it doesn't save anything, and UpdateModel doesn't throw any errors. I'm assuming I have to give it a little more direction to get the magic to work, because UpdateModel doesn't know which item in the vehicles array to use for each update.
Do I need to specify a ValueProviderResult as the third parameter to UpdateModel? If so, how do I create one out of vehicles(i)? Am I completely off base in how I have this set up?
Why use UpdateModel -- which just updates the properties from form fields -- when you already have the form fields processed into model data? Can't you just assign the values from vehicle to item directly?
For Each item In original
For i = 0 To vehicles.Count - 1
If vehicles(i).vehicle_id = item.vehicle_id Then
item.license_nbr = vehicles(i).license_nbr
item.color = vehicles(i).color
Exit For
End If
Next
Next

Resources