Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 9th, 2008, 01:59 PM
Registered User
 
Join Date: Feb 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need some help!!! How do I do this???

I need some help! I need some code in vb6 that will allow a user to input a word into the program. Then each character of the word will be compared to each letter of the alphabet and each occurrence will be counted. ex - dog is inputted it will have 1 occurrence of d and o and g. All other letters will be 0 occurrences. I will then display the results a scroolbox. results - a - 0, b - 0, c - 0, d - 1, etc.... I am thinking two arrays to somehow do this. Any ideas??

Reply With Quote
  #2 (permalink)  
Old February 11th, 2008, 01:43 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

First of all, that is not much of a subject line. It is clear from the fact that you are posting a question in the first place that you need help with something. The purpose of the subject line is to attract people who have expertise in the area where you need help, without them having to read your question first.

Second, you stated unnecessarily in your subject line that you need help. So there's [u]reall</u>y no need to [u]re</u>state that in the body of your post...

I would loop through the entered word in a For loop:
Code:
    Dim i as Integer
    For i = 1 to Len(TheWord)
        ' then use Mid$(TheWord, i, 1) to access the character.
    Loop
    Characters have numeric value, their ASCII value. (For instance, “A” is ASCII 65.) If you are treating each character as only A through Z, convertng a through z to capital, you can dimension an array Dim TheArray(ASC("A") To ASC("Z")) As Integer, and increment the elements by testing the specific character's ASCII value with ASC(TheChar). If you are spanning the whole alphabet, both upper and lower case, You can make two arrays, and use an If statement in which if your char is between ASC("A") and ASC("Z") one part will be run that increments the right element in the UCase array, and the else part which is run if your char is between ASC("a") and ASC("z").
The incrementation can be
Code:
    MyArray(Asc(TheChar)) = MyArray(Asc(TheChar)) + 1
You could have just one array, which would have what is essentially a void area between ASC("Z") and ASC("A").
Reply With Quote
  #3 (permalink)  
Old May 5th, 2012, 11:17 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Query in Datagriview

Hi there,..I am new to vbnet 2008. I need a code sample to perform a query in my datagridview project, I am using access 2003. I have been trying several coding standards...and it doesn't work. To give you an idea of what I want, my project has several textboxes to show data from the grid. To perform the query, I am using a textbox and a search button to perform the query, but the code that I am using doesn't work...What Shall I do?
Reply With Quote
  #4 (permalink)  
Old May 7th, 2012, 08:07 AM
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Can you post your code snippet here.

Also ig would be good if you can post in on a VB.NET forum instead of Vb6

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips &amp; Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 07:55 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.