ListBox Help
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Ok just picture this with me, I know I don't have the proper skills to make this, but view it from text as you will.
I have a listbox and I want to make it look like this:
Page Title Column | Url Column
Msn.com | http://www.msn.com
____________________________________
Add Button | Delete Button | Delete All Button
How do I make it look like that and when I hit the add button it adds the page title and the url at the same time on the same line and when I hit delete it deletes only the one selected item and leaves the rest of the titles and urls alone, and when I hit the delete all button everthing is gone?
I have a listbox and I want to make it look like this:
Page Title Column | Url Column
Msn.com | http://www.msn.com
____________________________________
Add Button | Delete Button | Delete All Button
How do I make it look like that and when I hit the add button it adds the page title and the url at the same time on the same line and when I hit delete it deletes only the one selected item and leaves the rest of the titles and urls alone, and when I hit the delete all button everthing is gone?
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
Harley
[Information Technologist in training, New to the whole VB coding]
Listboxes aren't great for columns. Consider using a ListView instead.
Though you could try what has been posted here: viewtopic.php?f=32&t=2475&p=15896#p15896
Though you could try what has been posted here: viewtopic.php?f=32&t=2475&p=15896#p15896
Now using this will I be able to select one part like either the url or the name and it will delete the whole thing?
Oh wait I see what you are saying so how do I make the columns for this and how do I make this work?
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
Harley
[Information Technologist in training, New to the whole VB coding]
oh really? is it for listbox or listview?
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
Harley
[Information Technologist in training, New to the whole VB coding]
That is for listbox.
This is the way to do it with a listview:
This is the way to do it with a listview:
Code: Select all
ListView1.View = View.Details
ListView1.Columns.Add("column1")
ListView1.Columns.Add("column2")
ListView1.Items.Add(New ListViewItem(New String() {"value1", "value2"}))
mandai wrote:That is for listbox.Ok I get the first three lines, but what are the strings for? can't I just add the items in the colums? I also have another question, sorry if I took so long for a reply, but I was out camping for a few days and I had a great time, since this is for bookmarks and I am using a listview how can I make it to where they both are in the same string in the settings or do I have to make seperate strings for the items?
This is the way to do it with a listview:Code: Select allListView1.View = View.Details ListView1.Columns.Add("column1") ListView1.Columns.Add("column2") ListView1.Items.Add(New ListViewItem(New String() {"value1", "value2"}))
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
Harley
[Information Technologist in training, New to the whole VB coding]
The string array in the 4th line is an example, it has to be an array so the listviewitem knows which column each value belongs in. There is no other way to do that.
You could have a bookmark name as one value and the url as another value, then you access it with Items(x).SubItems(y).Text - where x is the listview item index and y is whether you want to get the name or the url value.
You could have a bookmark name as one value and the url as another value, then you access it with Items(x).SubItems(y).Text - where x is the listview item index and y is whether you want to get the name or the url value.
Ok just another question.
I am sorry I wasn't clear enough let me add some more details.
This is what I am trying to do.....
Also you see this code?
Code: Select all
The codes above is what I am using now for my bookmarks in the listbox how can I transfer this into listview codes so it still has the same effect because when people right click on the selected item they can click remove and it removes the bookmark from the box and the settings without changing anything else.Dim i As Integer = lstBookmarks.SelectedIndex
lstBookmarks.Items.RemoveAt(i)
My.Settings.Bookmarks_Menu.RemoveAt(i)
I am sorry I wasn't clear enough let me add some more details.
This is what I am trying to do.....
Code: Select all
And for some reason it isn't working. The whole dim thing well after the = sign it is underlined in blue. How do I change that so it will work and I don't know if I have to put a code in there to remove the item in both columns or will remove both from the code up there?Dim i As Integer = listview1.SelectedIndex
listview1.Items.RemoveAt(i)
My.Settings.Bookmarks.RemoveAt(i)
Also you see this code?
Code: Select all
This code add the bookmarks, and my setup is to listboxes. One listbox that has the page name and the other listbox has the url, with that code up there how can I alter that for the two colums I made called Page Name and URL? My.Settings.Bookmarks.Add(ComboBox1.Text)
ListBox1.Items.Clear()
For Each Item As String In My.Settings.Bookmarks
ListBox1.Items.Add(Item)
Next
My.Settings.BKDocTitle.Add(CType(TabControl1.SelectedTab.Controls.Item(0), WebBrowser).DocumentTitle)
ListBox3.Items.Clear()
For Each item As String In My.Settings.BKDocTitle
ListBox3.Items.Add(item)
Next
Sincerely,
Harley
[Information Technologist in training, New to the whole VB coding]
Harley
[Information Technologist in training, New to the whole VB coding]
Copyright Information
Copyright © Codenstuff.com 2020 - 2023