.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 15th, 2004, 01:05 PM
gencor45 gencor45 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 4 gencor45 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Please help me!

I am having trouble trying to compare a string from a textbox to a combo box list.
Im very new to VB.net and here is what I am trying to do:

The Search button will look for the phrases containing the phrase the user has specified in the text box and display all such phrases (each on a separate line) in a message box. Search should first check that the user has entered something in the text box. Give an appropriate message if not. Remember to nest any checks so that only one message displays at a time. If the text box is not empty, use a For/Next loop to check each item in the combo box to see if it has the phrase entered by the user in the text box. (You won’t need a foundBoolean here since the entire combo box must be checked even if you’ve found one.) If the phrase matches, add it to a String that you will later display in a message box with all the matching phrases. Remember you want each phrase on a separate line in the message box. You can use &= to keep adding to the String. When you declare this String you’ll have to set it initially to “”. After the loop is finished, check whether there is anything in the String. If not, inform the user via a message box that there are no phrases containing the user-input phrase and call Clear Labels. If the String isn’t empty, display a message box with all the phrases from the combo box that matched the input phrase. Then call Clear Labels.

Do whatever is necessary to match phrases regardless of case. So, for example, if the user enters kent it will match Kent.

One point about the items from the combo box that you are comparing to the text box has to do with Option Strict On. ComboBox.Items(indexInteger) is not regarded as a String. When you enter the For/Next loop you’ll have to use ToString to convert it before you can compare it to the text box Text property which is a String.

Here is what I have so far:
im loopIndexInteger AsInteger

Dim maximumInteger AsInteger

maximumInteger = listComboBox.Items.Count - 1

Dim listCompareString AsString = ""

Dim textCompareString AsString

If inputTextBox.Text = "" Then

MessageBox.Show("You must enter something in the text box")

Else

For loopIndexInteger = 0 To maximumInteger

listCompareString = listComboBox.Items(loopIndexInteger).ToString()

listCompareString = listCompareString.ToUpper()

textCompareString = inputTextBox.Text.ToUpper()





Next



EndIf


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > Please help me!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT