Mirage Source http://miragesource.net/forums/ |
|
VB6 - Basics 1 - Dim what? http://miragesource.net/forums/viewtopic.php?f=211&t=5888 |
Page 1 of 1 |
Author: | Jacob [ Mon Jun 29, 2009 1:10 pm ] |
Post subject: | VB6 - Basics 1 - Dim what? |
I'm gonna post some basic tutorials / guides for the new users. If you see any errors or if you have any ideas please let me know. Basics 1 - Variables. Byte 8-bit: Values from 0 to 255. Whole numbers only. Integer 16-bit: Values from -32768 to 32767. Whole numbers only. Takes 2 bytes in memory. Long 32-bit: Values from -2,147,483,648 to 2,147,483,647. Whole numbers only. Takes 4 bytes in memory. (This is 'int' in c++ and c#) Single 32-bit: Values from -3.402823e38 to -1.401298e-45 for negative values. Values from 1.401298e-45 to 3.402823e38 for positive values. Takes 4 bytes in memory. Double 64-bit Values from -1.79769313486232e308 to -4.94065645841247e-324 for negative values. Values from 4.94065645841247e-324 to 1.79769313486232e308 for positive values. Takes 8 bytes in memory. String The String data type is usually used as a variable-length type of variable. A variable-length string can contain up to approximately 2 billion characters. Each character has a value ranging from 0 to 255 based on the ASCII character set. Strings are used when Text is involved. In VB6, you declare variable in the following manner: Code: Dim [name of variable] as [Data Type] Example - declaring 'b' as a byte: Code: Dim b as Byte Project Our first project will be a basic form application that will add 2 values together. The data types can be whatever you want. Display the output. Overview
Notes
|
Author: | Rian [ Mon Jun 29, 2009 6:08 pm ] | ||
Post subject: | Re: VB6 - Basics 1 - Dim what? | ||
SPOILER: (click to show)
|
Author: | Joost [ Tue Jun 30, 2009 12:33 am ] |
Post subject: | Re: VB6 - Basics 1 - Dim what? |
Dim A As Byte, B As Byte A=1 B=1 Msgbox("A+B") |
Author: | Beres [ Tue Jun 30, 2009 12:59 am ] |
Post subject: | Re: VB6 - Basics 1 - Dim what? |
Joost wrote: Dim A As Byte, B As Byte A=1 B=1 Msgbox("A+B") Now wont that just display "A+B" in the messagebox? It wont calculate it because its in strings. Code: MsgBox(A + B) Thats the proper way. |
Author: | Jacob [ Tue Jun 30, 2009 12:12 pm ] |
Post subject: | Re: VB6 - Basics 1 - Dim what? |
Beres wrote: Joost wrote: Dim A As Byte, B As Byte A=1 B=1 Msgbox("A+B") Now wont that just display "A+B" in the messagebox? It wont calculate it because its in strings. Code: MsgBox(A + B) Thats the proper way. Beres is correct. Joost would just show "A+B" and not actually perform any math. |
Author: | Joost [ Tue Jun 30, 2009 9:01 pm ] |
Post subject: | Re: VB6 - Basics 1 - Dim what? |
I was just testing you! Dim A As Byte, B As Byte A=1 B=1 Msgbox("A+B = " & A + B) |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |