I'm a bit of a newbie and my question probably has a simple answer... I have searched this site and Google, but haven't found an answer yet? JaredPar's answer to the above question seems to be the answer to my current need, but I pasted his code into my program and it gives me the following problem:
SelectedIndex is not a member of ListView.
This is the only code I have found so far to delete the same selected item from more than one ListView.
I am inserting node text from a Treeview into a ListView and a DataGridView(DGV). When the user inserts the wrong item from the Treeview and decides to delete it both from the Listview and the DGV, the user selects the item from the current list in Listview and clicks the Delete button. This should delete the same item in both the Listview and the DGV to maintain both lists updated. The Listview is used for a visual list during user selection of items by clicking on Treeview nodes. The DGV is used for filtering a saved list of all the items introduced by user in this way.
I was using the following code until I came across the code by JaredPar under the above title, but this only removes an item from Listview. JaredPar's code appears to remove the selected item from 2 Listviews:
For i As Integer = ListView1.SelectedItems.Count - 1 To 0 Step -1
ListView1.SelectedItems(i).Remove()
Next
I hope my question is understandable and that someone can help me with this to be able to learn from your examples! Thanks for any help!
Related
I am beginner at programming. I'm trying to build a form based app using visual basic according to a example in youtube.
In the form I cant move a item from listbox1 to listbox2 which was searched in textbox2
When I write the first item which is placed in first row of listbox1 it moves item to listbox2 but if I try with another item it cant move to listbox2.
I would be happy if someone can help me about this case.
Here are a picture of my form and the code I use :
a Lot depends on what you are putting into the listboxes. If it is simple stuff like a, b, c, d etc it will add everything to listbox 2 as you have your code under text_changed event. Try and use a button when user stopped typing to search for the entire word.
Also add your text after the sc Call to your sc sub before the return statement as well -
Sub sc()
''Current code
''If Textbox2<text - remove, already called...
Listbox2.Items.Add(Listbox1.Text)
Listbox1.Items.Remove(Listbox1.SelectedIndex)
Return
End Sub
i have a form with datagridview in vb.net that show my data in columns. what i'm trying to accomplish is that after choosing a row and pressing Edit button a new form will open and split the row for the right text boxes to update the data. the datagridview row shows different types of data: name,email,date,etc... any idea? Thanks in advance!
In the EditButton click-handler, you may access the selected row in your datagridview with the MyDataGridView.CurrentRow property.
This object - a DataGridViewRow - has Cells, which you can access individually by index and then get to their values:
...CurrentRow.Cells(n).Value
This then, in turn, you may use to fill the items in your edit form.
After completing your edit form, retrieve the (updated) values and put them back into the CurrentRow.Cells(n).Value
If your datagridview is databound, then you can also work directly with the datastore, through
...CurrentRow.DataBoundItem
The type of this object depends of course on your configuration; it may, for instance, be a DataRow.
This should be enough to get you going.
Final note on your added remark "thanks ...": you're apparently new at this site. I'm not sure why you got "downvotes". It may be because your question is rather elementary ("homework"), or people found your problem description not clear/detailed enough. Please, understand that answers (if any) are provided "unpaid for", and require "voluntary" effort from the contributors. Understandably they prefer that YOU do most of the work/study/trying, before asking someone else "to do your work for you". No offense intended.
In my form,i have a list of employees in a combo box and i need to map some employees to particular department.I need to change the combo-box to List box.Scenario is as follows,
1. List A contains all employees.
2. If i click 'Add' button the selected employees must move to list B
and list A must contain remaining employees
.
I searched for List box but i couldn't find in extjs4.
Is there any example or link for multiselect listbox in ext-js4?
Thanks
There is no built-in ListBox widget in ExtJs4. However, Ext.view.View may become an listbox after some manipulations.
Here is an example of such a tuned View. Demos may be found here, here and here (this one looks like just what you need).
You can create two such listboxes and the "add" button. Then assign handler to button which would remove selected item from the first listbox's store and add it to the second's store.
I have two drop down boxes in my program. When you select an item from the first drop down, it populates select-able items in the second. When I select something in the second and then change the selection in the first one, the values remain in the second. How do I "reset" the second drop down when the first is changed?
Any help would be awesome!
The drop down is in a windows form.
You have to reset the comboxBox items collection before adding the new items :
comboBox.Items.Clear()
Hope that helps.
I'm working with very old VB.NET legacy code in an ASP.NET project, so I'm not sure if this answer will help anyone or not. Here is what I did to clear our dropdown list:
ddlCategory.ClearSelection()
The code in the .aspx file looks like this:
<asp:DropDownList ID="ddlCategory" runat="server" Style="width:250px">
ClearSelection() did exactly what I needed it to do. It cleared the dropdownlist selection so that nothing was selected. The box was blank, but when you dropdown the list, all the options are still available to choose from.
i have created a dynamic table through vb.net, so htmltable, htmltablerow, htmltablecell.
I have added all style and properties in there. so eg.
dim td as htmltablecell
td.style.add("width","100px")
td.style.add("color","blue")
now what i want to do is add the tag to each row. this is because the first td of every row is a checkbox. and then textboxes follow. So when anyone clicks on the textbox, i want to checkbox to get checked.
Any idea how I can do this?
Your question is near incomprehensible, consider revising?
td.style.add("color","blue") now what i want to do is add the tag to each row
Since your table is dynamic, to add more styles and properties onto htmltablerow, you would do just as you did with your htmltablecells.
So when anyone clicks on the textbox, i want to checkbox to get checked. Any idea how I can do this?
You're looking for what is called the on_click event for the textbox. Programatically, when this event is triggered, you check your checkbox. Here's an example with a on_click in a textbox.