Populating A Font List And Removing Specific Items?

Sep 23, 2009

I've gotten a listbox control to populate with a list of installed fonts, but I need to be able to click a button and remove the selected item from the listbox. How do I do this? Every time I try, an exception is thrown.

Here is the code:

Public Class Form1
Dim fonts as New Drawing.Text.InstalledFontCollection
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[code]....

View 2 Replies


ADVERTISEMENT

Removing A Font From Windows Font List (2010)?

Jun 8, 2011

I am trying to make a program that basicly, on the click of a button, removes a font from the windows font list (Un-installs it) Is there a way to do this using VB.NET (2010)The reason I want to do this is to make a program to remove the 'Comic Sans MC' font from all computers I use my pendrive on?

View 9 Replies

Removing Items From A List Box?

Jun 8, 2011

I have button that adds items to a list box and a button that removes it...the one that adds it works great but when i select an item to remove it doesn't remove it..i don't know if there's something wrong with the code or not..

Private Sub btn_Remove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_Remove.Click
list_MyOrder.Items.RemoveAt(list_MyOrder.SelectedIndex)
prices(list_MyOrder.SelectedIndex) = 0
MsgBox("Select any item to remove")
End Sub

View 5 Replies

Removing Items From A List View?

Jan 31, 2010

I have a form with 2 listview's and I want to remove that items in the listview1 that area duplicated on the listview2.

View 8 Replies

Removing Items From A List(Of T) Failing?

Dec 17, 2009

I have a generic list that I'm removing items out of using List.Remove(Object). I have been removing items but whenever I get to the fifth item I'm removing it fails and does not remove it from the list. It doesn't seem to matter what I'm removing but everytime I try to remove five items it fails on the fifth item.

View 4 Replies

Removing Multiple Items From A List Box At Once?

May 2, 2010

If I have 3 times selected and when I click "submit" for example I want all my selected items to be removed, but when I try to do this only my first selected item is removed.

ListBox.Items.Remove(ListBox.SelectedItems)

How do I remove all 3 items from the list box at the same time?

View 2 Replies

VS 2010 - Removing Items From A List (of T) With For Each

Dec 14, 2010

Public Structure ReportOrderType
Public ReportName As String
Public ReportDate As Date
Public SaveFile As String
End Structure
[Code] ....

Basically, I have a list of reports. In one place they get ordered, and later on the program looks to see which ones have come back -- see if the .SaveFile exists on disk. If it exists, then that report gets processed, and then I want to remove that item from the list of reports-on-order. However, I get an error message back that by doing the .Remove(R), I've changed the list itself & things won't go well with the rest of the For Each loop, which makes some sense.

When I get to this routine, the list of ordered reports will be something from a couple of dozen or less, and some number of them (perhaps zero, perhaps all, probably a few) will exist & be processed & then should be removed from the list. How should I go about accomplishing this? This is my first time working with List(of t) as a Visual Basic tool; everything I've used in the past has been with arrays, and I can do this there.

View 15 Replies

VS 2010 List (of T) Removing Items?

Mar 7, 2012

I have the following

Public itemArray As New List(Of ItemArrayStructure)
Public Structure ItemArrayStructure
Dim DisplayText As String
Dim Checked As Boolean
End Structure

If I know the DisplayText of an item in this array, how can I remove it?

View 2 Replies

Forms :: Error In Removing Items From The List Box?

Oct 17, 2011

Imports System.Collections.Generic
Imports System.Net
Imports System.IO

[Code]...

View 3 Replies

Forms :: Removing Items From Binding List?

May 24, 2011

have a binding list which i want to be able to add and remove items.This is the class im using

Friend Class ExecutableItem
Public Property Text() As String
Public Property Method() As Action

[code].....

View 2 Replies

Removing Items From A List Box After Setting The DataSource

Sep 29, 2010

I have a small requirement and that is as follows:

I am populating a ListBox using stored procedures and the ListBox is populated as follows:

lstItems.DisplayMember = "emp_name"
lstItems.ValueMember = "login_id"
lstItems.DataSource = accessFunction.getEmployees

The ListBox gets populated correctly. After it is populated, i have a CommandButton and on the click event of the button, i want to remove selected items from the ListBox. So in the click event of the CommandButton, i have written the following code:

lstItems.Items.Remove(lstItems.SelectedItem)

After selecting an item from the ListBox and when i click the CommandButton, i get an error as "Items collection cannot be modified when the DataSource property is set".

how i can delete items from the ListBox.

View 2 Replies

VS 2008 Removing Items From List Of Class?

Jun 12, 2010

I've searched on the Internet and I can't find a solution to this simple problem. I've also looked on Microsoft's MUCH improved MSDN site and haven't found a solution, so here it goes. I'm trying to remove an entry from a list of class and it doesn't get removed. Here's a sample of the code I'm trying: (I renamed the class and variable names to make it a simple example)

Dim lstClass As New List(Of TheClass)
Dim mClass As TheClass
I tried this first
mClass.filename = "The Entry to Delete"
lstClass.Remove(mClass)

[Code]...

View 3 Replies

Adding And Removing Items From The List And Tree Views

Mar 10, 2009

I am trying to learn how to work with the different controls in Visual Studio for VB.Net in particular the List View and Tree Views. I don't have any code to show as I am not working on anything in particular just messing around with it to learn what the different controls do that weren't covered in my Intro to VB.Net class last semester.I would like a clearer explanation on how to actually use code for these controls. In particular adding and removing items from the List and Tree Views using code.

View 1 Replies

Forms :: DataGridView DataError Exception When Removing Items From Bound List?

Nov 2, 2011

I am using a DataGridView bound to a BindingSource which is itself bound to a List of objects. This all works well until I remove objects from the list. If I am scrolled down to the bottom of the DataGridView and then remove a bunch of items from the list it is bound to it generates a DataError exception because the length changed and the rows I am looking at no longer exist... I changed my code to handle that error, but now instead of popping up a message it SLOWLY erases the data in each of the newly invalid rows at the end of the table (I think each time it does one it generates a new DataError, which is why it is so slow).

How do I prevent this? I want to be able to dynamically (and programmatically) add and remove items from the table without the possibility of this error... I assumed this would be handled automatically as part of the data binding process but I guess not.

View 1 Replies

[2005] Font And Fontsize - Change Selected Font In List Accordin Font In Combobox?

Mar 7, 2009

How to list all font in combobox, and how to change selected font in list accordin font in combobox?

View 3 Replies

How To Select Specific Items From A List

Sep 28, 2010

I am working with a list of points. It is declared as a global in my form.[code]the only issue is that instead of New Point(100,100) i need to be able to navigate to the previous 4 records in the list. pull out the 4 x vals the 4 y vals and boom there you go. In the old days id make a simple loop and get r done but im not sure the syntax to step through the list that way.

View 8 Replies

Ranking Of List Items Based On Specific Property?

Feb 17, 2012

I need to determine the ranking of the List items specified by one specific property of the items.

I have the following Class:
Public Class LevelA
Property items as New List(Of LevelB)
Public Class LevelB
Property factor as Double
ReadOnly Property rank as Integer
End Class
End Class

For example, let's say I have three items in the List. I have set the factor property for the first item as 5.50, the second item as 6.60 and the third item as 3.30.Now I should be able to get the rank property of each item (the highest value should be ranked as 1). Here the first item in the list should have the rank as 2, the second item as 1 and the third item as 3.

What kind of procedure is needed for the "ReadOnly Property rank as Integer" for returning such values? It should somehow be able to access the list in the parent class probably?

View 3 Replies

Find Specific Characters (items) In String Array (or List) And Then Merge Them?

Mar 8, 2012

I'm having a problem recently, a logical issue so hard to determine various examples.I need the text that is inserted in textbox, which has been altered or modified or twisted to have a proper format through line accordance and constant white spaces etc. And some cases I stuck at defining the If statement within the loop. Here's an example of a text I'm trying to reformat.[code]I'm using Microsoft Visual Studio 2010 Ultimate version with Microsoft SQL Server Management Studio. This code is being fired on mouse click event of a button control. This is a snippet of my code there are more filtering after but here is what should be changed.

View 11 Replies

Forms :: Removing Items The Next Items Doesn't Remove Only The First One?

Oct 22, 2011

Imports System.Collections.GenericI
mports System.Net
Imports System.IO
Public Class Form2
'Dim filename As String
Public ftpSettings As FtpClient

[Code]...

I don't know what's wrong, i can only move the 1st item but the second and so on doesn't make any changes. It remains in a listbox.

View 1 Replies

Removing Specific Folder From ZIP?

Jul 2, 2011

I'm developing an application that adds .class files to a .jar using Ionic.Zip (Found Here) but this library does not support removing files from a zip, only adding them. Is there another free, open-source API that would allow me to add and remove files from an archive?

For those of you who don't know, .jar files work the same as .zip files, except their executable java files. The .jar i'm adding to and removing from, the developer said that anyone can do such things with it if they want.

View 1 Replies

Way To 'hide' A Specific Row In Listview Instead Of Removing It?

Jun 19, 2009

I am using window application VS2005 to write a program. The listview will only show the data that meet the criteria set in the combobox.Is there any way to 'hide' a specific row in the listview instead of removing it? [code]

View 1 Replies

ComboBox - Populating All Date For Specific Month Selected By User

Apr 21, 2010

I need to populate all date for an specific month selected by the user from a combobox where I added all months name. How I can create array of any months of the year, very new coder in vb.Net.

View 1 Replies

Removing Specific Lines Of A Multiline Textbox

Feb 26, 2010

What I am trying to do is remove lines of a multiline TextBox based on certain criteria, such as the number of characters or words. For example, if I paste a list of phrases into the TextBox, I want to remove all phrases that contain more than 25 characters. Once the phrases are removed, I then want to remove the empty lines that are left behind, but I have commented out the ".Replace(vbCrLf & vbCrLf, vbCrLf)" for the sake of making the results easier to follow (see screenshot from Excel below, which includes a blank cell wherever a phrase has been removed).

Here is my

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim lines() As String = TextBox1.Text.Split(vbCrLf)

[Code]....

Why is it not "blanking" the entire line in ALL cases where the line contains more than 25 characters?

View 4 Replies

Office Automation :: Removing Specific Text From A String?

Jun 6, 2011

How do I go about removing specific instances from a string. For example, I've got this string 50/2/2 and I want it to reads as 50/2/2 by removing instances of [31m, [32m, [33m, and [0m

View 2 Replies

VS 2010 ListView Box Usage; Removing A Specific Item?

May 19, 2011

I have a form with a ListView box and a button. When the user clicks on the button, the following code adds an item and subitem to the ListView box. The ListView box has 2 columns (Name and Gold).

Private Sub btnTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTest.Click
Dim testName As String = "Slasher"

[code]....

View 8 Replies

.net - Removing Items From A ListView?

Feb 1, 2010

I am trying to search through listview in VB.net 2008. It works fine with small list, but when the list is big ( around 25000 rows), if I search multiple items , it fails saying that index is not valid. Obviously what I understand is , it it tryiong to remove an index does not exist. But I am unable to figure out where exactly it is going wrong.

PS : while it is doing search through the entire listview, I am incrementing index = index+5 becasue I want the next 5 rows to be in the selection state as well.This is the code Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp If (e.KeyCode = Keys.PageDown) Then

[Code]...

View 2 Replies

Removing Duplicate Items ?

Oct 31, 2009

I am populating a combobox with data from a .txt file; however, there are 1000 entries but only 4 different possibilites 1, 2, 3, and 4. How can I have the combobox only allow a selection of the 1-4 with repeating all 1000 numbers?

View 3 Replies

Removing Items From A LB When Not Selected?

Apr 23, 2012

So I have three listboxes, LB1 is an uploaded list, LB2 is a master list, and LB3 is generated from LB1 items that are NOT in LB2. I have a button that replaces the selected item from LB1 with the selected item from LB2, woot.Since LB3 is a subset of LB1, I want to be able to select the items from LB2 and LB3 and have it replace the item from LB1 but running into some trouble with finding the appropriate item without selecting it. [code]
highlight Fred from LB1 and Freddy from LB2, click and Fred becomes Freddy in LB1. I want this same change to happen but by selecting the "Fred" located in LB3 (If LB1 is hundreds of names long, I don't want to have to sift through it and only make the changes that need to be made). [code]

View 2 Replies

Removing Items From The Listbox?

Mar 5, 2012

Im working on a school project where i add items to a listbox in two columns. The first being the name of a course and the second being the credit hours of the course. I can add and remove the items just fine BUT when i remove an item im also required to subtract the credit hours of said item from a variable i have called "totalhours." Essentially im trying to figure out how to subtract a certain piece of a selected listbox item from my class level variable.

View 2 Replies

Removing The Listbox Items?

May 26, 2011

I got this code but it won't work...

For Each item In ListBox1.Items
For i As Integer = 0 To ListView1.Items.Count - 1
If item.ToString = ListView1.Items(i).Text And ListView1.Items(i).SubItems(1).Text = TextBox4.Text Then

[code]....

It only deletes 1 listbox item while there are more items that have to be deleted.after debugging i get this:List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change.

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved