473,698 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Filtering a List Box of words

2 New Member
I have:

A textbox (txtLetter)
A button (btnDisplay)
A listbox (lstColors)

On run time, the form automatically creates an Array and gets information from a .txt file.

What I'm trying to do is make it so that the user can input a letter into the textbox, and when btnDisplay is clicked, it would filter the listbox so that only the words with the same starting letter will be displayed.

Can anyone please help me out here?

Thank you.

My code:

Public Class Form1
Dim Colors() As String
Dim strColors As String
Dim upperBound As Integer

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Dim sr As IO.StreamReader = IO.File.OpenTex t("a6Colors.txt ")
Dim numLines As Integer
numLines = 0

Do While (sr.Peek <> -1)
strColors = sr.ReadLine
numLines += 1
Loop
upperBound = numLines - 1
sr.Close()
End Sub

Private Sub btnDisplay_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnDisplay.Clic k
ReDim Colors(upperBou nd)
Dim sr As IO.StreamReader = IO.File.OpenTex t("a6Colors.txt ")

For i As Integer = 0 To upperBound
Colors(i) = sr.ReadLine
Next

For i As Integer = 0 To upperBound
lstColors.Items .Add(Colors(i))
Next



End Sub
End Class
Mar 30 '07 #1
0 1269

Sign in to post your reply or Sign up for a free account.

Similar topics

19
4568
by: MKoool | last post by:
I have a file with binary and ascii characters in it. I massage the data and convert it to a more readable format, however it still comes up with some binary characters mixed in. I'd like to write something to just replace all non-printable characters with '' (I want to delete non-printable characters). I am having trouble figuring out an easy python way to do this... is the easiest way to just write some regular expression that does...
13
3881
by: kevinold | last post by:
Hello everyone, I have a list of about 1600 employees that I'd like to have displayed in a form. I'd like to make the "search" for the user as easy as possible. I ran across this: http://www.barelyfitz.com/projects/filterlist/ filter that works quite well with small lists (on the site is a list of 20 names). It also works quite well in Firefox 1.5, but crawls in IE 6.
19
3548
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main form, the subform returns the records based on the two criteria. The criteria used on the main form are values selected in two list boxes. When the user clicks on the first list box (lstCollege), it returns values in the second list box...
5
328
by: sensible | last post by:
Can I solve this problem using Access? If so, will some give this newbie a simple step by step on how to go about it, please....all the way from File/New. In Excel I am using data/filter/autofilter to filter my long list of words, one per row...trouble is in my Excel the columns are only 60,000 rows deep, and my word list is 1,500,000, This means I have to break my list into 26 seperate lists. This makes filtering very...
2
1642
by: Darren Clark | last post by:
I am currently developing a site that will have a members sectin where data can be posted... Nothing huge there.. My question is, what are some methods that i can use that will stop swear words from being posted, how can i detect swear words in text?
7
14806
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I want to look at that data and filter it based on what is in it. I know that this could have been done with data sets and data views in asp.net 1.1 but how is this done now in asp.net 2.0?
2
5018
by: engwar1 | last post by:
I'm building a page for a website that will allow for anonymous users to post comments. I want to filter out words deemed offensive or obscene. I know HOW to build this feature but I'm wondering if there are any examples of a list of bad words that I can present to management as a starting point for words that we'd filter. Yes I've googled and haven't found a whole lot. I found George Carlin's extensive list of words and one other...
3
6629
by: Harry Haller | last post by:
Hello, I want to implement a generic list which will be used to display 7 columns in a GridView. One should be able to sort, filter and page each of the 7 columns. Ideally the filter should be implemented simultaneously for multiple columns - but the data need only be sorted by a single column at a time. Sorting should be both ascending and descending. I'm currently using a DataView but it's far too slow, because there are a large...
3
1381
by: Zethex | last post by:
Alright I got asked today by a friend this question, which obviously I couldn't help him with. He needs to get rid of words in a string referring to an already given list then needs to map them using a function he already has. Ill explain this better by giving an example :P Say ur given these lists: un_words =
0
1128
by: Eric Wertman | last post by:
You should check out the sets module: http://docs.python.org/lib/module-sets.html
0
8675
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6521
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.