A calculator I made

Demi666

New Member
Ok, this was my first project for VB6
Its a very very very simple calculator. It knows the terms plus,minus,divided,and multiplication.

Also Please post reply with feedback/thoughts

If anyone find a bug please post it here

Edit:
Fixed a small typo that sometime could couse wrong numbers in the calculation

Also im working on a File Manager its WIP atm, ill release beta here later =)

Code is here:

Code:
Dim iForm1 As Integer, iForm2 As Double, iA As Double, strOption As Double, sstrVariable As String, strVariable As String, ttText As String, cCounter As Integer
'Made by Demi666 a.Ka John Bradley

Public Sub Command1_Click()
Form1.Caption = "Loading."
Form1.Caption = "Loading.."
Form1.Caption = "Loading..."
Form1.Caption = "Loading...."
Form1.Caption = "Loading....."
Form1.Caption = "Loading......"
Form1.Caption = "Done!"

    iForm1 = CInt(strVariable)
    iForm2 = CInt(sstrVariable)
        
        If Option1.Value = True Then
        strOption = iForm1 + iForm2
                ttText = "+"
            ElseIf Option2.Value = True Then
            strOption = iForm1 - iForm2
                    ttText = "-"
                ElseIf Option3.Value = True Then
                    strOption = iForm1 / iForm2
                            ttText = "/"
                        ElseIf Option4.Value = True Then
                            strOption = iForm1 * iForm2
                                    ttText = "*"
                        End If
        
        
        
Label1.Caption = iForm1 & ttText & iForm2 & "=" & strOption
End Sub



Private Sub Form_Load()
Call MsgBox("This calculator was made by John Bradley a.Ka Demi666", vbOKOnly, "Credit")
End Sub

Private Sub Label1_Click()
Label1.Caption = ""
Call MsgBox("The text has been cleared", vbOKOnly, "Calculator")
End Sub

Private Sub Text1_Change()
strVariable = Text1.Text
End Sub

Private Sub Text2_Change()
sstrVariable = Text2.Text
End Sub

Private Sub Timer1_Timer()
cCounter = cCounter + 1
Form1.Caption = "Calculator  " & cCounter & " - " & Time
End Sub
 

Attachments

holy_spirit

New Member
Glade to see some code here
I'll check it later
+rep for being a programmer ;-)
Note: try to use comments, it gives your Code more understandability
 
>Whats wrong with VB?
Does exactly what you want, so there's nothing wrong with it.

It works nicely, but one bad thing is that it doesn't create a button on the bar (no idea what those are really called), so if I have many windows opened, it's like pain in the ass to search for the calculator.

You should work on the layout a bit. Maybe create a textbox (where cannot be written anything) where the result is shown.

The size of the "Calculate" button is ridiculous.

The number increasing and current time on the top isn't needed at all for a calculator, but I guess you're just learning some basics.
 

Demi666

New Member
>Whats wrong with VB?
Does exactly what you want, so there's nothing wrong with it.

It works nicely, but one bad thing is that it doesn't create a button on the bar (no idea what those are really called), so if I have many windows opened, it's like pain in the ass to search for the calculator.

You should work on the layout a bit. Maybe create a textbox (where cannot be written anything) where the result is shown.

The size of the "Calculate" button is ridiculous.

The number increasing and current time on the top isn't needed at all for a calculator, but I guess you're just learning some basics.
>The number increasing and current time on the top isn't needed at all for a calculator, but I guess you're just learning some basics.

Learn by doing^^ so yea

>You should work on the layout a bit. Maybe create a textbox (where cannot be written anything) where the result is shown.

There is, if i take 50 * 2 it says under the texbars 50*2=100

>The size of the "Calculate" button is ridiculous.
Its imba

>It works nicely, but one bad thing is that it doesn't create a button on the bar (no idea what those are really called), so if I have many windows opened, it's like pain in the ass to search for the calculator.

I can make that:p
 
Whats wrong with VB?
Nothing per se, it simply offers a very ugly and very limited programming experience. Delphi might be a better alternative for the things you're doing.

>Whats wrong with VB?
Does exactly what you want, so there's nothing wrong with it.
This sort of pragmatism doesn't work. All (well, most) cars can drive, so there should be no reason to choose one car over any other?
 
You, TheDamien, are too much against everything.

>All (well, most) cars can drive, so there should be no reason to choose one car over any other?
I don't drive cars. I <3 these!
 

n[u]ll

You can change this now in User CP.
Nothing per se, it simply offers a very ugly and very limited programming experience. Delphi might be a better alternative for the things you're doing.
Delphi IS better(In the long run that is). You can do a lot more with it, and it's very easy to learn. It's what my dad prefers, and so he taught me it, and I believe it's a great choice:thup:.

If you do choose Delphi, you will want to download:
TurboDelphi

One of the best compilers/IDE I've seen.. No sense in getting the other versions Borland offers (a.k.a. the one's you pay for) because the only main difference is you can install Add-Ons, which you generally don't need.

Another great learning language is Pascal. However, keep in mind it was created for teaching basics of programming, and often going from Pascal to a more challenging language, like C++, will be very hard because the syntax is much different and it is Not Object Oriented.

And finally, if you are getting into programming so you can someday create games, I'd suggest the D Programming Language. It's got everything C++ (which is probably the most common language for game programming) has to offer, without dealing with memory. This means that, for the most part, you won't have to worry about memory leaks..
 

Demi666

New Member
>
Rapidly build web and internet applications
Rapidly build web applications without needing to know HTML, Javascript, CSS, or HTTP using the IntraWeb technology bundled with Turbo Delphi for Win32. Write applications that access the full range of Internet communications protocols with the InternetDirect (Indy) suite of components.

Do i need to know HTML etc?
I never heard of this language and i didnt really understand ... i mean.. why should i choose this instead of vb6(i know vb6 is old..)
 

n[u]ll

You can change this now in User CP.
Well, it's not just for web apps, they just have packages that help you build web apps because people like using Delphi for that.

You don't need to know HTML at all, though if you're going to do web development it's highly recommended (along with PHP, CSS, and JavaScript).

It's just a general purpose programming languages. You can create anything from that basic Hello World program, to using DelphiX DirectX to program advanced 3D Games. However, it is not the best language for game programming, for game programming you'd want to look into C++, C, or D.

Look into Delphi more with these following links:
http://en.wikipedia.org/wiki/Delphi_(programming_language)
http://delphi.about.com/cs/azindex/a/dhistory.htm

And here's a list of highly known programs built with Delphi:
http://delphi.wikia.com/wiki/Good_Quality_Applications_Built_With_Delphi
Some ones you might know off that list are
Ad-Aware
FL Studio
and Skype
 

Demi666

New Member
Delphi sounds good, is Delphi object oriented ?
And can you recommend me somewhere where i can learn basics? also i learned VB6 from iHe-Support so they helped me alot ^^ also i found a book about it, so if you have msn it would be great, if i need to ask you something or w/e
 

n[u]ll

You can change this now in User CP.
Books are always a great resource. You should check out, O'Reilly's Safari.
They always have some great books, and what's great is that all of their books are also uploaded as PDF's, meaning you don't have to get the physical book. If you wish not to spend much money on it, then
http://delphi.about.com/
has a lot of great resources and tutorials..

But if I were you, I would stay away from books and tutorials (for the most part). Because, for me at least, I don't like being taught, I'd rather learn it on my own.. I remember things easier that way, and you develop your own unique style, and creativity is a big part in just about anything..

And, yes, it is Object Oriented..
 

Rad

...
I don't think I could have learned to understand more complex things in programming. Things like pointers and references in C++, and understand public/private variables in declaring objects.

Also, don't you think its kind of pointless to put your name in such a trivial program? Calculators are usually the first thing people make. If someone knows how to program something that would even be able to use this, they could easily just write their own.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Test!
  • tom_mai78101 tom_mai78101:
    I must be in a test server.
  • tom_mai78101 tom_mai78101:
    Nice, Twitter tweets embedding now works
  • Wizard Wizard:
    Yup.
  • Ghan Ghan:
    Excellent.
  • Ghan Ghan:
    @tom_mai78101 Hello there.
  • Ghan Ghan:
    Tagging works in the chat too.
  • tom_mai78101 tom_mai78101:
    @Ghan Missed it.
  • Wizard Wizard:
    Still fixing things here and there. Added widgets to the portal, will make it match the ones here on the forum index tomorrow.
  • Ghan Ghan:
    The venerable World Editor Tutorials site has been converted to HTTPS at last.
  • jonas jonas:
    cool
  • jonas jonas:
    and I can even edit my messages, nice
  • seph ir oth seph ir oth:
    GENERAL CHIT CHAT, YOU ARE A BOLD ONE
  • Ghan Ghan:
    Hello there
  • The Helper The Helper:
    this new chatbox is great and the forum software update is great too
    +1
  • The Helper The Helper:
    upgrade has fixed forum registration spam problem
  • tom_mai78101 tom_mai78101:
    Something tells me we might be able to customize the chatbox a bit, considering that there's a gap under every message.
  • Wizard Wizard:
    Going to deploy a fix soon, just had to take some time for myself this weekend.
  • Varine Varine:
    Unbelievable. Time for yourself? How dare you!
  • Wizard Wizard:
    xD
  • tom_mai78101 tom_mai78101:
    Hm, it is now harder to type anything on an Android phone. Pressing Backspace or Enter keys will dismiss the Android keyboard for some reasons.
  • tom_mai78101 tom_mai78101:
    Just noticed there's a delay of at least 2 minutes before each post. Guess I can't post Headline News quickly as I used to.
  • tom_mai78101 tom_mai78101:
    As far as I can tell, there are definitely things I need to get accustomed to first.
  • Varine Varine:
    FCC is cracking down recently

    Members online

    No members online now.

    Affiliates

    Hive Workshop
    Top