Click here to Skip to main content
13,140,591 members (47,060 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 9 Sep 2008

Fill MSFlexGrid with Numbers and Create Mathematical Trick

, 15 Sep 2008
Rate this:
Please Sign up or sign in to vote.
Create Mathematical Trick by displaying seven numerical tables using MSFlexGrid


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.


  • 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.


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

Last Words

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

Contact Details


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


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

No Biography provided

You may also be interested in...


Comments and Discussions

GeneralI shall search again.. Pin
Mostafa Kaisoun12-Sep-08 8:31
memberMostafa Kaisoun12-Sep-08 8:31 
GeneralPart of solution.. Pin
Mostafa Kaisoun12-Sep-08 8:24
memberMostafa Kaisoun12-Sep-08 8:24 
Generalabout the trick Pin
LotharLanger11-Sep-08 6:33
memberLotharLanger11-Sep-08 6:33 
GeneralI know, but how?! Pin
Mostafa Kaisoun10-Sep-08 7:13
memberMostafa Kaisoun10-Sep-08 7:13 
GeneralRe: I know, but how?! Pin
Rafael Oliveira10-Sep-08 11:43
memberRafael Oliveira10-Sep-08 11:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.170915.1 | Last Updated 15 Sep 2008
Article Copyright 2008 by Mostafa Kaisoun
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid