Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




LIST BOX HELL. Please Save, Remove Items, Many List Boxes...one Last Name


ok, so the code so far, or as much as you need to see, is
****************************
***************************
***************************
***************************
***************************

Sub LoadCal()
Dim gdtDate As Date
Dim i As Integer
Dim x As Integer
Dim startDay As Integer
Dim giMaxDays As Integer

' clear list boxes before filling again
For i = 0 To 41
List1(i).Clear
Next

' * * * * * * * * * * * * * * * * * * * * * *
' * * * * * ADD DAY NUMBERS * * * * *
'label at top of form
Label1.Caption = MonthName(giMonth) & " " & giYear

'this is the current date
gdtDate = CDate(giMonth & "/01/" & giYear)

'minus one so the first line is never completely empty
startDay = Weekday(gdtDate) - 1

'the number of days in this month
giMaxDays = Day(DateAdd("m", 1, gdtDate) - 1)

'populates list boxes with days
x = 1
i = startDay
While i < (giMaxDays + startDay)
List1(i).AddItem (x)
x = x + 1
i = i + 1
Wend

' * * * * * * * * * * * * * * * * * * * * * *
' * * * * * ADD NAMES TO DAYS * * * * *

' !!!!!!!!!!!!!!!!!check to see that list is not empty !!!!!!!!!!!
If lstAgentList.ListCount = 0 Then GoTo done
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

'agent list counter, "at which item" index
x = -1
'populate list boxes from the first day of the month with numbers
i = startDay
'counter for number of days until sunday
a = startDay - 1

'from the first day to the last day
While i < (giMaxDays + startDay)
If a < 6 Then
'a maximum of 3 names per day
While (List1(i).ListCount) < 4
' if there are no more items in the items list ('x' is greater than counter)
If x < (lstAgentList.ListCount - 1) Then
x = x + 1
' otherwise set it back to 0 (zero)
Else
x = 0
End If
'add the next name from the established agent list
List1(i).AddItem (lstAgentList.List(x))
Wend
a = a + 1
Else
'a maximum of 3 names per day
While (List1(i).ListCount) < 4
'add the next name from the established agent list
List1(i).AddItem (lstAgentList.List(x))
'here we do not increment name for it is a sunday
Wend
'reset 7 days until sunday counter
a = 0
End If
'increment day count
i = i + 1
Wend

done:
' end
End Sub



***************************
***************************
***************************
***************************
now see the shaddy thing with this is...well, it's a calendar month see, and every day is a list box....first item, the date, 1st, 2nd, 3rd, 4th, and so on...each list box can hold that first item, the date, plus 3 names.

if someone double clicks on one of those names (which are populated through other methods...not important) i want that name to be deleted...now where i am out of ideas is: how do i delete one item from one list when my list (List1) is an array of about 41 list boxes all named List1 (x) see....

also if I wanted that name which was double click to delete itself through the entire month, then ....well...the rest is my own trouble...but so far i can't seem to be able to delete.

grrr.
...

thanks in advance,
-munchkin




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
List Box (Remove Items)
I have a listbox in which I load mp3's for an mp3 player, i also have a "Remove" button on my form, how would I remove JUST the selected song from the list, and not the entire list?? Thanks again!

List Box, Remove Items 1 By 1
I am using a progress bar with a list box. The plan was to have the progress bar move along as the items in the list box were deleted (the program has to go through other steps before removing an item, and this task can take a while to complete). Anyways, this is what I have to remove the items from my list box, however, it only seems to remove the even number items and leave other items in the list box:
Code:
For i = 0 To List1.ListCount - 1
    List1.RemoveItem i
Next i

Remove Items From List Box
why does when adding items to a list box all items are added according to index increment, but when items are removed only even items are removed????


thanks for your help

dave ...this is the code

Private Sub Command1_Click()
Dim Entry, i, Msg ' Declare variables.
Msg = "Choose OK to add 100 items to your list box."
MsgBox Msg ' Display message.
For i = 1 To 100 ' Count from 1 to 100.
Entry = "Entry " & i ' Create entry.
Debug.Print Entry & " "
List1.AddItem Entry ' Add the entry.

Next i
Msg = "Choose OK to remove every other entry."
MsgBox Msg ' Display message.
For i = 1 To List1.ListCount ' Determine how to


Debug.Print List1.ListIndex

Debug.Print List1.ListIndex
List1.RemoveItem (i)

Next i ' item.


Msg = "Choose OK to remove all items from the list box."
MsgBox Msg ' Display message.
List1.Clear ' Clear list box.

End Sub

Check Box To Remove Items From List?
I have made this progam that picks random things from two lists and displays them on a form. I was wondering if there is a way i can have it so when i check a check box labled one of the items in one of the lists will not show up anymore.

How Do I Remove Empty Items From A List Box?
How do i remove empty items from a list box?

Thanx

Remove Item From 2 List Boxes
Hi!

I have 2 list box controls with same values - the first list is sorted and the other one is not. I hide/show approprate lists if user wants sorted/unsorted items.

Now I would also like to let the user to delete items from the list - deleting from one list is simple, but how can I delete the same entry in another one (as the list index is not the same)?

I guess it could work by looping thorugh the list and deleting the list entry that has the same text, but is there and easier way?

Bostjan

List Boxes Remove Item
how would you remove an item from a list box?

Move Items In 2 List Boxes
I need a code that when the user either clicks up or down items in 2 listboxes will move.

Let me explain... when the user clicks the second of the first list box then clicks the up cmdUp button the second item of the second listbox will also move up. Any suggestions?

List Boxes (adding Together Items)
I have a listbox and in the first listindex is 3 in the second index is 4 and i want to be able to output to a label the sum of these two figures i.e. 7

Thanks

Access 2002 - Remove Multiple Items In A List Box (Resolved)
In Access 2002, does anyone know the best method for removing selected items from a Multi-Select ListBox?

On my Form, I have one Multi-Select ListBox and one button that allows the user to delete the selected item(s) from
the ListBox. In my "btnRemoveTo_Click" event, I have tried the following 2 methods to remove the selected items from the list box. However, in my looping routine, when I issue the .RemoveItem command, all the items that were selected in the Multi-Select list box, become unselected, thereby leaving no items selected. For instance, if the user has 5 items selected, the first time the .RemoveItem code is issued the first item selected is Removed from the list box, but after that, all the items become deselected, leaving me with no items selected - therefore no other items are removed.

Code:Private Sub btnRemoveTo_Click()
Dim vItem As Variant, iRow As Integer
' Remove all the items selected from the list box.
With Me
    If .listSendTo.ItemsSelected.Count = 0 Then
        Exit Sub
    Else
        ' METHOD #1
        For iRow = .listSendTo.ListCount - 1 To 0 Step -1
            If .listSendTo.Selected(iRow) Then .listSendTo.RemoveItem iRow
        Next

        ' METHOD #2
        'For Each vItem In .listSendTo.ItemsSelected
        ' .listSendTo.RemoveItem vItem
        'Next
    End If
End With

End Sub


edit:: marked as resolved.



Edited by - Metallisoft on 5/19/2004 4:24:24 PM

Removing Items Form List Boxes!
i have got a listbox having items>

a
a
a
b
b
n
b
a
a
a

when i click a button i want all the items "a" to be removed form the listbox! so that it will look like this>

b
b
n
b

with all the "a" removed!

Sorting List Boxes And Combining Items That Are The Same
I'm trying to get list boxes to stack items that are the same and tally the number of times it appears. For example, during execution, if I added items "Red", "Green", "Yellow", and "Red" again, it'd look like this.

Red (2)
Green
Yellow

Or something like that. Is it possible with the default list boxes without a massive amount of code?
Thanks.

List View Selected Items In Text Boxes
Dear Friends,

When I select one item {because I have only one coloumn in listview } (eg: Name) from a listview which is connected to DB2.MDB (Table Name is : TB2) and displays the data from TB2, I would like all the text boxes to show all the records pertaining to the selected name. I have four fields in TB2.

What code should be written:

Help With File List , Dir List And Drive List Boxes..
How do i link my drive list , file list and dir list boxes to gether , so that when i for exaple set the drive list to c: , the dir list will then give all dir in there, and file list will show me files from the directory, right now the default file list is set to my vb file list and i cant change it...

Editing List Items And ListSubItems In List View Control
Hi,

It is possible to edit ( add an entry ) the first column of a ListView control. By setting to automatic mode.

How do I edit the subsequent columns ( The listSubItems ).

BB

Combine List Items To Create New Item In Same List?
Hi all,

This has been giving me fits for a few days - any help would be most appreciated. I'm sure it's pretty simple, but I'm new to VB (and programming in general) and can't seem to come up with the correct syntax to get this to work:

I have a listbox from which the user can select mutliple items. Once user performs a multi-select, I enable a button (no problem there). When user clicks that button, I want to create a new item in that same list consisting of all selected items with "AND" between them.

Thus, if user had selected <item 1>, <item 2>, and <item 4>, the new item would be "<item 1> AND <item 2> AND <item 4>". Can someone please help me with the logic and syntax on this?

Here's what I have up to this point (I've removed the parts that I believe - based on the fact that this is not working - to be wrong and replaced them with ?????):

Code:
        Dim terms As String
        For Each terms In List.SelectedItems
            If List.SelectedItems.Count > 1 Then
                terms = ??????? & " AND " & ???????
            End If
        Next
        List.Items.Add (???????)


Thanks!!



Edited by - troy_atl on 10/17/2005 12:04:26 PM

How To List The Items Of Combo List When It Get Focus Without Click On It
Hi:
Here I have problem, I have a Combo list. If the user don't want to use mouse, and She want the Combo list list all of of it's item just like mouse click on it when she use TAB to focus on it. How can I implement this function. If anybody know about it. It will be very helpful
Millions of Thanks.


wky086

Remove Selection Bar From List Box, Without Disabling List Box??
i don't want the user to be able to create the big blue horizontal bar that appears when u click in the list box. However i do not want the list box to be disabled because the text goes gray and is hard to read.

How could i make the blue bar not show??

Cheers

GTJ

Remove The Last 4 Letters From My List Box List Names.
Hello,

I have a list box that loads .bmp files and I can view them by clicking on the selected item.

My question is how do I remove the .bmp from the end of the name?

My list box looks like this:

Pic1.bmp
pic2.bmp

And I want it to look like this:

Pic1
Pic2

Thank you and have a great day!

Stilekid007

List Box, How Can I Paint Specific Items On A List
Hi,

I've got a list box, and I want to paint specific items on it.
I've tryed to use the ".forecolor" property, but it paints all the list.
also I've tryed to approach the specific item ".list(index).forecolor"
with no success

Thanks in advance, ofir

List Box, How Can I Paint Specific Items On A List ?
I've got a list box, and I want to paint specific items on it.
I've tryed to use the ".forecolor" property, but it paints all the list.
also I've tryed to approach the specific item ".list(index).forecolor"
with no success

Thanks in advance, ofir

List Box - Selecting Items To Be Displayed Into Another List Box
Hi,
I'm pretty new to this and for my assignment I've been set the task of using arrays (and saving the array in a Random Access file) but to to get to the point. This program currently adds and saves the array and then displays the user data into a listbox. However I want the list box items that have been saved to be displayed individually in another listbox (hope i'm making this clear.)
So for instance

In listbox LstUsers
I have records stored data which contains the name , address, postcode , package option chosen etc.
This information is pretty long so what I want the program to do is when the user selects one of these records in LstUsers it will then display that data in another List box called for example LstDetails.

I know i'd have to use an If statement but im unsure of the value i'm supposed to use. If anyone could give me a hand with this i'd be grateful thanks in advance.

Drive List And Directory List Boxes
I have one drive list box and one directory list box in my program.
When I run my program I can see all Local and Mapped network drives.
But I need to add the Network Neighborhood in the Drive list box.
I need to be able to see all servers and drives on the network. Can anyone tell me how to do this? Thanks!

Drive List And Directory List Boxes
I have one drive list box and one directory list box in my program.
When I run my program I can see all Local and Mapped network drives.
But I need to add the Network Neighborhood in the Drive list box.
I need to be able to see all servers and drives on the network. Can anyone tell me how to do this? Thanks!

Dragging List Items Around A List Box: Example
Since I can't post this in the code library, I thought I'd share it here. This code is pretty simple. It allows items to be reordered in a list box by dragging them around.

Put this in General Declarations

Code:
Dim item1 As String, item2 As String, listindex1 As Integer, listindex2 As Integer

Put this in for your list events.

Code:
Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
'When the mouse is clicked, we want to save the text at the spot
'and the index of the spot to variables
item1 = List1.List(List1.listindex)
listindex1 = List1.listindex
End Sub
Private Sub List1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
'When the mouse is released, we want to save the text and the spot
'again. Then we print the text to opposite spots in the list.
item2 = List1.List(List1.listindex)
listindex2 = List1.listindex
List1.List(listindex1) = item2
List1.List(listindex2) = item1
End Sub

Importing List Items To Another List
i need a code which will import all the items of list1 to list2!

so that the lists will look identical!

Selects Items From List Box To List Box?
Hi everyone!

Has anyone seen a good example of how to set up a list box and then have an arrow button pointing to another list box which allows the user to select the items they want...... geesh this is hard to explain, and I dont know what to call it....

Basically the first box contains all of the possible selection avliable to the user and the highlight each one they want and hit the 'arrow' pulling those selected items into the 'selected' box. Make sense?? Most that I've seen professionally done include arrows to 'de-select' and another set to 'select all' and 'deselect- all'

Any pointers or examples on how to do this would be greatly appreciated. I currently have a well functioning program using just a single selection at a time and would like to upgrade it to have this type of functionality.

Thanks!
Willie

Saving Items (selected Items) In List Box To A Text File
I need help in coding the following:

1. Saving (or exporting) the items displayed in List Box to a text file.

2. I have a long list of data to be displayed. When I use this List box all of my data does not fit into the width. I was wondering if there is similar other way where I can do horizontal as well as vertical scrolling. I tried text box and its of no help i guess.

All Things In Form Text Boxes List Boxes...Saving
Is the a command thats save every thing that is changed changed in form ...all text boxes all list boxes ...everything that has changed

Is There A Way To List Items In A List Box Using Tab?
I have a listbox with two variables (USER2(J) and ATTL) that lists a user's initials and then the total number of orders completed. Side by side together a user's name may be two initials or three initials - this throws off the PRINT output and even some initials like jfs may be smaller then emp! So I would like to really do a


Code:
List1.AddItem USER2(J); tab(10); ATTL

but it doesn't work...the List add item only recognizes & instead of ; and + and those items don't work either?

Any suggestions?

Thanks for the help.

Stephen

Web Control, List Boxes, Text Boxes, Please Help This Is Winding Me Up!
Hi guys i need some help with the webcontrol function in VB6

Part of my program needs to put listbox data from the program into a text box on the web and then click a submit button...

The list box i have has a list of multiple directories in (for the location of my files), from there i just want the program to put the top directory of the list box into a text box on the web and click a submit button on the web (its for uploading a queue of files), then after that has finished uploading, do the next directory in the list box... etc

It sounds pretty simple but i have no idea how to do it...

Thanks for any help you can give me, i will write a really good review about you and good rating etc.

Any knowledge of this would be greatly appreciated

thanks a bunch

toodle pipples

Alex

Combo And List Boxes To Text Boxes?
Connecting sub-menus to rich text boxes is fine is most cases but the user does not always want to use menus to load and display text. Applying the same technique as sub menus to text boxes with combo or list boxes just wont work could someone please help me out with this one.

Both combo and list boxes will for example:

Contain an alphabetic list.
When the user clicks on a file it should locate the text file from the drive.
It should then open it into a rich text box on the same form.

Could this be possible?

Please any help will greatly be appreciated.

Bit Of List/Remove Help
Code:
listDeleteCat.RemoveItem (listDeleteCat.Text)
Open "C:Program FilesDemoSuite Admin-PaneldataSeries.txt" For Output As #1
Print #1, listDeleteCat
Close #1
'Fills the category combobox with all the categories in the Delete Category section
With listDeleteCat
Open "C:Program FilesDemoSuite Admin-PaneldataSeries.txt" For Input As #1
listDeleteCat.Clear
While Not EOF(1)
Line Input #1, buf$
.AddItem (buf$)
Wend
End With
Close #1
I get the error "Type Mismatch" on the follow line


Code:
listDeleteCat.RemoveItem (listDeleteCat.Text)
Basically what its supposed to do is "remove" the item I have selected on the list, then save the data. The refresh the data

What am I doing wrong, and if you know please leave a few tips.

Remove Certain Value From List Box
Alright, got a question for you!

Say I have a list box named ‘lstOnline’

It contains the values:



Simon

Marc

Josh

Adrian



Each one of those being a separate list item.


How would I remove a certain value.. say I wanted to remove “Marc” from the list.

Is this possible?


Thanks!

Remove From List
hey i want to remove the selected item in list1 from the list. I cant figure it out. Thanks.

Remove From List Box
I have a button and a list box. I need code for the the button to remove a list entry from the list box.

List Box Remove Item
Ok i need to remove a list box line when it is selected and then when i hit a command button it removes it as well as the same line in the other list boxes. The list boxes are in an array.

How To Remove Duplicates From A List Box?
How do I remove duplicates froma list box?

Remove Item From List???
I have a really simple problem, well for you guys anyway. For some reason it won't let me delete an item from the list once I have clicked on it. I get a 'type mismatch' error.


Code:
FuelDelete = lstFuel.Text
lstFuel.RemoveItem FuelDelete

Any ideas why this is happening?
Thanks to whoever can help me

How Remove From A List And From A Table?
Hi folk, I'm trying to create a CommandButton that can remove from a list and after from my table the same number, look the code:

--------------------------

Private Sub cmdRemExt_Click()

'Remove from the List
lstSpaExt.RemoveItem lstSpaExt.ListIndex

'Remove from the Table
ExtSpa.Delete

End Sub

---------------------------

VB6 DEBUG always tell me "NO CURRENT RECORD", how can I do to select something to the command ExtSpa.Delete procede?

Thanks a lot.

How Remove From A List And From A Table?
Hei folks:

Now I'm trying this code, it's working into the form but don't is updating the table, why?

------------------------------------------

Private Sub cmdRemExt_Click()

Dim RemExt As String
RemExt = lstSpaExt.ListIndex

'Remove from the Table
ExtSpa.Seek "=", RemExt

If ExtSpa.NoMatch = False Then
ExtSpa.Delete
End If

'Remove from the List

lstSpaExt.RemoveItem RemExt

End Sub

-------------------------------------------

Add/Remove Program List
Hello everyone,

I would like to retrieve a list of installed programs (ones that show up in Add/Remove programs) and store them to an array of strings.

Could anyone help please? Thanks

Remove List Index Via ID
I would like to remove the Customer from the my list box using the CustomerID not the key, but I could not achieve this.

Below is my class's codes


Code:
Public Sub Remove(ByVal strCustomerID As String)

mCustomers.Remove strCustomerID
End Sub

Public Function Item(ByVal strCustomerID As String) As CCustomer

Set Item = mCustomers.Item(strCustomerID)
End Function



Then


Code:
Private Sub DisplayData()
'transfer from the collection to the text boxes

With mCustomers.Item(txtCustomerID.Text)
txtCustomerID.Text = .CustomerID
txtFirstName.Text = .FirstName
txtLastName.Text = .LastName
End With
End Sub

and once the user selects OK, I had a select statement


Code:

Case "R"
'remove from listbox
With frmMain.lstCustomer
.RemoveItem .ListIndex
End With

'remove from collection
mCustomers.Remove txtCustomerID.text

End Select



Once I click OK button, I got the runtime error 5, invalid procedure call or something

How Do You Remove Duplicates From A List Box?
i need to get rid of duplicate entries in a listbox? how would i go about this?

thanks alot

Remove Character From List Box
i have a list box with "234j3243+"
"324geee"
"4325543+"
etc etc

is there a way to remove the "+" from the list but leave the other letters and numbers behind ?

hope i didnt confuse u

Remove Blank From List
How do I remove Blank Items from a listbox?

Remove End Of Item In List
I need to search a listbox and if it has a item with :: in it i need it to remove the :: from the item. The :: is always at the end of the item if that makes a difference.

List - Remove Item
I have a list where the user is able to add data to, but I want them to be able to remove items also. I have a remove buttom where once clicked I have some code, but I don't know how to specify which one to be removed. I obviously want the item selected in the list ot be removed, but I don't know how... Here's what I have now


VB Code:
Private Sub cmdRemoveBuddy_Click()    lstBuddies.RemoveItem    ' RemoveItem requires an integer, I'm guessing the index number of the list item..End Sub


Help? Thanks!

Copyright © 2005-08 www.BigResource.com, All rights reserved