What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Argh Visual Basic

Pages: (3): « First « 1 [ 2 ] 3 » Last »
Argh Visual Basic
Author: Message:
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Argh Visual Basic
You could try using vbNewLine to create a newline

code:
Private Sub cmdcalc_Click()

    Dim Timestable, Number As Integer

    For Timestable = 1 To 12
      For Number = 1 To 12
        frmTables.Print Number & " x " & Timestable & " = " & (Number * Timestable) & vbNewLine
      Next Number
  Next Timestable
End Sub

This post was edited on 03-03-2005 at 09:03 PM by matty.
03-03-2005 09:02 PM
Profile E-Mail PM Find Quote Report
Wabz
Elite Member
*****

Avatar
Its Groovy Baby!

Posts: 3459
Reputation: 29
38 / Male / Flag
Joined: Jan 2003
O.P. RE: Argh Visual Basic
Thanks Matty but that didn't do it either  I worked out theres a tab command that can list the tables in columns which goes tab(10)  but i dont understand the use of it exactly


Heres the source I currently have for it www.likethat.org.uk/tables.zip

This post was edited on 03-03-2005 at 11:31 PM by Wabz.
Mess.be Forum Moderator
Messenger Plus ex-IRC Network Admin
Gimme a Rep!
03-03-2005 11:28 PM
Profile E-Mail PM Web Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
RE: Argh Visual Basic
use Chr(10)
The previous sentence is false. The following sentence is true.
03-04-2005 12:04 AM
Profile PM Find Quote Report
Wabz
Elite Member
*****

Avatar
Its Groovy Baby!

Posts: 3459
Reputation: 29
38 / Male / Flag
Joined: Jan 2003
O.P. RE: Argh Visual Basic
Huh where?  It wont work where i think its supposed to go :S
Mess.be Forum Moderator
Messenger Plus ex-IRC Network Admin
Gimme a Rep!
03-04-2005 01:09 AM
Profile E-Mail PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Argh Visual Basic
code:
Private Sub cmdcalc_Click()

    Dim Timestable, Number As Integer

    For Timestable = 1 To 12
      For Number = 1 To 12
        frmTables.Print Number & " x " & Timestable & " = " & (Number * Timestable) & CHR(10)
      Next Number
  Next Timestable
End Sub
OR

code:
Private Sub cmdcalc_Click()

    Dim Timestable, Number As Integer

    For Timestable = 1 To 12
      For Number = 1 To 12
        frmTables.Print Number & " x " & Timestable & " = " & (Number * Timestable) & CHR(10) & CHR(13)
      Next Number
  Next Timestable
End Sub

This post was edited on 03-04-2005 at 01:55 AM by matty.
03-04-2005 01:53 AM
Profile E-Mail PM Find Quote Report
XM4ST3RX
Full Member
***

Avatar
DJ Scoop!

Posts: 172
Reputation: 12
37 / Male / –
Joined: May 2003
RE: Argh Visual Basic
Hi,

I dunno if this will make it more tidier and easier for you to use.
It's using a listbox, and it sections off each times table.

When you click on a certain times table, it shows each corrosponding equation in the second listbox.

I've uploaded the source anyways, so check it out.
Hope it helps.


Kind Regards,
XM4ST3RX

.zip File Attachment: Times Tables.zip (1.27 KB)
This file has been downloaded 101 time(s).
03-04-2005 02:34 AM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Argh Visual Basic
If you want to directly write/print to a form, you must take in account the type of font you're using. Normal/default fonts are not proportional (just like on this forum). This means that even if you put a tab character between your columns, the columns wouldn't be aligned properly and you will get this:

1 x 1 = 1         1 x 2 = 2         1 x 10 = 10         1 x 12 = 12
2 x 1 = 2         2 x 2 = 4         2 x 10 = 20         2 x 12 = 24
3 x 1 = 3         3 x 2 = 6         3 x 10 = 30         3 x 12 = 36
...
8 x 1 = 8         8 x 2 = 16         8 x 10 = 80         8 x 12 = 96
...
10 x 1 = 10         10 x 2 = 20         10 x 10 = 100         10 x 12 = 120

the columns aren't aligned.

So using tab characters to space your columns like this is almost always not advisable, just as to print directly to a form is almost always not advisable for the above reason. Also, printing 12 columns near each other will make your form very wide and inpracticle. A possible solution is the one shown by XM4ST3RX. This also shows that it is far better to not print directly to a form, but to a control. In the case of XM4ST3RX's code it are two listboxes.

To show what you want in theory, you could use a multiline textbox with a proporional font (eg: courier new) and using spaces to align the columns.

A bit more advanced would be to set tabstops in a control (listbox or textbox or whatever) and use the tabcharacter to align the columns. Setting tabstops must be done by calling an API; something you're not ready yet to use I assume :)

Anyways, here is the code to print all your columns side by side into a multiline textbox and using spaces to align the columns:

PS @ XM4ST3RX:
Do NOT do:
    Dim TimesTable, Number as integer
This will NOT declare TimesTable as an integer, but as a variant! Always seperate your declare statements to avoid such errors:
Dim Number As Integer
Dim TimesTable As Integer

.zip File Attachment: sample1.zip (2.21 KB)
This file has been downloaded 185 time(s).

This post was edited on 03-04-2005 at 10:21 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-04-2005 09:09 AM
Profile PM Find Quote Report
Wabz
Elite Member
*****

Avatar
Its Groovy Baby!

Posts: 3459
Reputation: 29
38 / Male / Flag
Joined: Jan 2003
O.P. RE: Argh Visual Basic
Thanks Guys, after all that I was in a lecture today and he basically shown us how to do this.  :@

Great help.  I can get on with the next one now TictacToe, control arrays :S
Mess.be Forum Moderator
Messenger Plus ex-IRC Network Admin
Gimme a Rep!
03-04-2005 01:36 PM
Profile E-Mail PM Web Find Quote Report
siebe
Junior Member
**

Avatar

Posts: 90
Reputation: 5
37 / Male / –
Joined: Nov 2003
RE: Argh Visual Basic
quote:
PS @ XM4ST3RX:
Do NOT do:
    Dim TimesTable, Number as integer
This will NOT declare TimesTable as an integer, but as a variant! Always seperate your declare statements to avoid such errors:
Dim Number As Integer
Dim TimesTable As Integer

Dim Number As Integer, TimeTables As Integer
Is fine too :) As long, like you said, each var carries a datatype

This post was edited on 03-04-2005 at 02:08 PM by siebe.
21 December 2012.
03-04-2005 02:08 PM
Profile E-Mail PM Web Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
Status: Online
RE: Argh Visual Basic
quote:
Originally posted by Wabz
Thanks Guys, after all that I was in a lecture today and he basically shown us how to do this.  :@

Great help.  I can get on with the next one now TictacToe, control arrays :S
So anyway, what did they tell you to do?

YouTube closed-captions ripper (also allows you to download videos!)
03-04-2005 02:15 PM
Profile E-Mail PM Web Find Quote Report
Pages: (3): « First « 1 [ 2 ] 3 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On