Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Fill MSFlexGrid with Numbers and Create Mathematical Trick

0.00/5 (No votes)
15 Sep 2008 1  
Create Mathematical Trick by displaying seven numerical tables using MSFlexGrid
ExeFile

Introduction

I am using seven numerical tables to create this Mathematical Trick. I found the idea of this trick in my old papers but I don't remember from which book or magazine I read it before. I confess that my work is a translation of this idea to a VB6 program.

Background

  • Choose number from 1 to 100, keep it in your mind.
  • I shall display (7) tables.
  • Every table contains some numbers.
  • Search for the number of your choice in every table.
  • If you find it: Click (Yes) button.
  • If not: Click (No) button.
  • After displaying last table (number 7):
  • I shall tell you your choice number!

Using the Code

The following code is an example to fill MSFlexGrid with numbers:

Dim c As Integer
Dim r As Integer
Dim n As Integer
Dim T As Integer

   With NumGrid
      T = 1
      For r = 0 To 4
         For c = 0 To 9
            .TextMatrix(r, c) = Str(T)
            T = T + 2
         Next c
      Next r

Please refer to the source code (Sub FillTab) to see how I fill the grid with numbers seven times.

Remarks

You can find the source code when you extract the file SourceFile.zip and you can find the *.exe when you extract the file ExeFile.zip.

Last Words

I hope that you enjoy this trick. If anybody knows the exposition of this trick, please let us know.

Contact Details

History

  • 9th September, 2008: Initial post
  • 15th September, 2008: Source and demo updated

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here