ComputerForum.com ComputerForum.com  
Go Back   Computer Forum > Computer Software > General Software

Reply
 
LinkBack Thread Tools Display Modes
Old 03-29-2007, 11:03 AM   #21 (permalink)
Moderator
 
Cromewell's Avatar
 
Join Date: Dec 2004
Location: Canada
Age: 25
Posts: 10,206
Default

Oh...yeah...it will do that. Anywhere you have txt_display = "" you gotta change to txt_display = "0"
__________________

You know what the chain of command is? It's the chain I go get and beat you with 'til ya understand who's in ruttin' command here.

I must plug a couple comics because they are good :D:
www.ctrlaltdel-online.com
www.userfriendly.org
Cromewell is offline   Reply With Quote


Old 03-29-2007, 11:08 AM   #22 (permalink)
VIP - Graphics Guru
 
Kornowski's Avatar
 
Join Date: Jul 2006
Location: Liverpool, UK
Age: 18
Posts: 12,819
Default

Right, I've done that, but the problem I have with it now is that there is a 0 at the begining of the text box and people won't want a 0 at the beggining of the number sequence, if that makes sense?
__________________
Intel Core 2 Quad Q6600
EVGA 750i SLI FTW
4GB Crucial Ballistix @ 800MHz
2 X 8800GTS G92 in SLI
Corsair HX520W
Windows Vista Home Premium
Seagate Barracuda 500GB 7200.11 SATA II
Tuniq Tower LED
OCZ XTC RAM Cooler
Antec 900 (Modded)
Kornowski is offline   Reply With Quote
Old 03-29-2007, 11:13 AM   #23 (permalink)
Moderator
 
Cromewell's Avatar
 
Join Date: Dec 2004
Location: Canada
Age: 25
Posts: 10,206
Default

To work around that, in each button press (it's technically better to make this it's own function but it's so small there's no point), check if txt_display contains "0" (ie
If cint(txt_display.text) = 0 Then
txt_display = <number pressed>
End If
)
I don't know you you allow people to type directly into the text box but you can create a similar process for that as well as restrict what keys it will accept.
__________________

You know what the chain of command is? It's the chain I go get and beat you with 'til ya understand who's in ruttin' command here.

I must plug a couple comics because they are good :D:
www.ctrlaltdel-online.com
www.userfriendly.org
Cromewell is offline   Reply With Quote
Old 03-29-2007, 11:44 AM   #24 (permalink)
VIP - Graphics Guru
 
Kornowski's Avatar
 
Join Date: Jul 2006
Location: Liverpool, UK
Age: 18
Posts: 12,819
Default

This is going straight over my head, lol
__________________
Intel Core 2 Quad Q6600
EVGA 750i SLI FTW
4GB Crucial Ballistix @ 800MHz
2 X 8800GTS G92 in SLI
Corsair HX520W
Windows Vista Home Premium
Seagate Barracuda 500GB 7200.11 SATA II
Tuniq Tower LED
OCZ XTC RAM Cooler
Antec 900 (Modded)
Kornowski is offline   Reply With Quote
Old 03-29-2007, 03:56 PM   #25 (permalink)
VIP - Graphics Guru
 
Kornowski's Avatar
 
Join Date: Jul 2006
Location: Liverpool, UK
Age: 18
Posts: 12,819
Default

Dim var_First_Number As Double
Dim var_Second_Number As Double
Dim var_Operator As String

Private Sub cmd_Clear_Click()
txt_Display = ""
End Sub

Private Sub cmd_Divide_Click()
If txt_Display = "" Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Div"
txt_Display = ""
End If
End Sub

Private Sub cmd_Eight_Click()
txt_Display = txt_Display & 8
End Sub

Private Sub cmd_Equals_Click()
var_Second_Number = txt_Display
If var_Operator = "Add" Then
txt_Display = var_First_Number + var_Second_Number
ElseIf var_Operator = "Min" Then
txt_Display = var_First_Number - var_Second_Number
ElseIf var_Operator = "Div" Then
txt_Display = var_First_Number / var_Second_Number
ElseIf var_Operator = "Mul" Then
txt_Display = var_First_Number * var_Second_Number
End If
End Sub

Private Sub cmd_Five_Click()
txt_Display = txt_Display & 5
End Sub

Private Sub cmd_Four_Click()
txt_Display = txt_Display & 4
End Sub

Private Sub cmd_Nine_Click()
txt_Display = txt_Display & 9
End Sub

Private Sub cmd_Plus_Click()
If txt_Display = "" Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Add"
txt_Display = ""
End If
End Sub

Private Sub cmd_Seven_Click()
txt_Display = txt_Display & 7
End Sub

Private Sub cmd_Six_Click()
txt_Display = txt_Display & 6
End Sub

Private Sub cmd_Subtract_Click()
If txt_Display = "" Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Min"
txt_Display = ""
End If
End Sub

Private Sub cmd_Three_Click()
txt_Display = txt_Display & 3
End Sub

Private Sub cmd_Times_Click()
If txt_Display = "" Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Mul"
txt_Display = ""
End If
End Sub

Private Sub cmd_Two_Click()
txt_Display = txt_Display & 2
End Sub

Private Sub cmd_Zero_Click()
txt_Display = txt_Display & 0
End Sub

Private Sub cmd_One_Click()
txt_Display = txt_Display & 1
End Sub


Theres the code now, I've fixed the overflow issue and the problem that it closes when you click a button and there's no value entered
__________________
Intel Core 2 Quad Q6600
EVGA 750i SLI FTW
4GB Crucial Ballistix @ 800MHz
2 X 8800GTS G92 in SLI
Corsair HX520W
Windows Vista Home Premium
Seagate Barracuda 500GB 7200.11 SATA II
Tuniq Tower LED
OCZ XTC RAM Cooler
Antec 900 (Modded)
Kornowski is offline   Reply With Quote


Old 03-29-2007, 09:12 PM   #26 (permalink)
Diamond Member
 
Emperor_nero's Avatar
 
Join Date: Sep 2006
Location: 127.0.0.1
Posts: 2,313
Default

Quote:
Originally Posted by Cromewell
To work around that, in each button press (it's technically better to make this it's own function but it's so small there's no point), check if txt_display contains "0" (ie
If cint(txt_display.text) = 0 Then
txt_display = <number pressed>
End If
)
I don't know you you allow people to type directly into the text box but you can create a similar process for that as well as restrict what keys it will accept.
I don't think that would work, becuase that would just let the user enter one digit. (Unless they entered zero)

Here, I've fixed that problem I think, and a divide by zero problem. And good morning, or good night.

Dim var_First_Number As Double
Dim var_Second_Number As Double
Dim var_Operator As String

Private Sub cmd_Clear_Click()
txt_Display = 0
End Sub

Private Sub cmd_Divide_Click()
If txt_Display = 0 Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Div"
txt_Display = ""
End If
End Sub

Private Sub cmd_Eight_Click()
txt_Display = txt_Display & 8
End Sub

Private Sub cmd_Equals_Click()
var_Second_Number = txt_Display
If var_Operator = "Add" Then
txt_Display = var_First_Number + var_Second_Number
ElseIf var_Operator = "Min" Then
txt_Display = var_First_Number - var_Second_Number
ElseIf var_Operator = "Div" Then
If var_Second_Number = 0 Then
MsgBox "Error, cannot divide by zero"
Else
txt_Display = var_First_Number / var_Second_Number
End If
ElseIf var_Operator = "Mul" Then
txt_Display = var_First_Number * var_Second_Number
End If
End Sub

Private Sub cmd_Five_Click()
txt_Display = txt_Display & 5
End Sub

Private Sub cmd_Four_Click()
txt_Display = txt_Display & 4
End Sub

Private Sub cmd_Nine_Click()
txt_Display = txt_Display & 9
End Sub

Private Sub cmd_Plus_Click()
If txt_Display = 0 Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Add"
txt_Display = ""
End If
End Sub

Private Sub cmd_Seven_Click()
txt_Display = txt_Display & 7
End Sub

Private Sub cmd_Six_Click()
txt_Display = txt_Display & 6
End Sub

Private Sub cmd_Subtract_Click()
If txt_Display = 0 Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Min"
txt_Display = ""
End If
End Sub

Private Sub cmd_Three_Click()
txt_Display = txt_Display & 3
End Sub

Private Sub cmd_Times_Click()
If txt_Display = 0 Then
MsgBox "Please enter a value", , "Incorrect Function"
Else
var_First_Number = txt_Display
var_Operator = "Mul"
txt_Display = ""
End If
End Sub

Private Sub cmd_Two_Click()
txt_Display = txt_Display & 2
End Sub

Private Sub cmd_Zero_Click()
txt_Display = txt_Display & 0
End Sub

Private Sub cmd_One_Click()
txt_Display = txt_Display & 1
End Sub

Private Sub Form_Load()
txt_Display = 0
End Sub
__________________
I play Rugby, and no its not like it's sissy cousin with the pads.


Last edited by Emperor_nero; 03-29-2007 at 09:20 PM.
Emperor_nero is offline   Reply With Quote
Old 03-30-2007, 12:06 AM   #27 (permalink)
VIP - Graphics Guru
 
Kornowski's Avatar
 
Join Date: Jul 2006
Location: Liverpool, UK
Age: 18
Posts: 12,819
Default

Thanks man, I'll give it a go, I'm not in college for another 2 weeks now though
__________________
Intel Core 2 Quad Q6600
EVGA 750i SLI FTW
4GB Crucial Ballistix @ 800MHz
2 X 8800GTS G92 in SLI
Corsair HX520W
Windows Vista Home Premium
Seagate Barracuda 500GB 7200.11 SATA II
Tuniq Tower LED
OCZ XTC RAM Cooler
Antec 900 (Modded)
Kornowski is offline   Reply With Quote
Old 03-30-2007, 12:10 AM   #28 (permalink)
Diamond Member
 
Emperor_nero's Avatar
 
Join Date: Sep 2006
Location: 127.0.0.1
Posts: 2,313
Default

Two weeks! why not? Spring break? and you don't have a VB program at home? Oh and your welcome. It was fun.
__________________
I play Rugby, and no its not like it's sissy cousin with the pads.

Emperor_nero is offline   Reply With Quote
Old 03-30-2007, 12:33 AM   #29 (permalink)
VIP - Graphics Guru
 
Kornowski's Avatar
 
Join Date: Jul 2006
Location: Liverpool, UK
Age: 18
Posts: 12,819
Default

Yeah!
I'm off for Easter holidays.

No, I don't have VB, I only have Excel's Alt + F11

Awesome!
__________________
Intel Core 2 Quad Q6600
EVGA 750i SLI FTW
4GB Crucial Ballistix @ 800MHz
2 X 8800GTS G92 in SLI
Corsair HX520W
Windows Vista Home Premium
Seagate Barracuda 500GB 7200.11 SATA II
Tuniq Tower LED
OCZ XTC RAM Cooler
Antec 900 (Modded)
Kornowski is offline   Reply With Quote
Old 03-30-2007, 12:37 AM   #30 (permalink)
Diamond Member
 
Emperor_nero's Avatar
 
Join Date: Sep 2006
Location: 127.0.0.1
Posts: 2,313
Default

Well you can get Microsoft Visual Basic 2005 Express Edition for free.
Have a good break. We just get one week of here.


And what's awesome? That is was fun?
__________________
I play Rugby, and no its not like it's sissy cousin with the pads.

Emperor_nero is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
homepage hijacked by nice.allxun sid Computer Security 2 12-03-2006 04:36 AM
Free AOL AVS (Kaspersky) Update edifier Computer Security 11 11-05-2006 03:09 AM
How to Use Free Software to Remove Spywares YuHang Computer Security 2 09-14-2006 10:50 AM

All times are GMT +1. The time now is 04:03 PM.


Powered by: vBulletin Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright © 2002-2008 Computer Forum and Web Design Forum