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
| 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 16th, 2005, 08:02 AM
Registered User
Join Date: Jan 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default WordSearch - Please Help!


I'm building a wordsearch program which uses a text box to display the actual word search (12 x 12 letters). I've managed to get it to search left-right and right-left ok.

Does anyone know how to search up or down the columns? Or even diagonally?

Please help!!

Thank you!
Reply With Quote
  #2 (permalink)  
Old January 18th, 2005, 11:53 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

Wow, tricky but not impossible.

For the up and down, just create an array that transposes the rows and columns of the 12 original lines. You can then search them the same way you did before.

For the diagonals, you'd have to do some more work but it's still the same. You'd have an array and you'd pick a starting point, say upper left, and assign the elements starting from that point. For a simple 4X4, the assignment would look like this:

A1 B2 C3 D4
B1 C2 D3 E3
C1 D2 E2 F2
D1 E1 F1 G1

So then you'd have an array with String1 = A1; String2 = B1&B2; String3 = C1&C2&C3; etc. At that point, you can search them the normal way, i.e. you can use the function Instr() to find strings within the larger string.

For backward searches, you'd do the same for left-right, up-down, diagonal, but you'd reverse the order of the squares in your arrays FIRST and THEN search. Or better yet, keep the same arrays and reverse the search string only and then look for it in the unreversed arrays.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote

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 11:02 PM.

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