Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Need help with visual basics
Closed Thread
Old 11-07-2006, 01:40 PM   #1 (permalink)
 
Junior Techie

Join Date: Feb 2006

Posts: 53

Flame

Default Need help with visual basics

Hi i just started to use visual basics and i need some help... Im writing this fast so sorry for mistakes!

what i want to do is make a MsgBox appear with Buttons inside of it that i have declared in variables...

I hope people understand me im only a couple of weeks into programming

this is what i have so far... im trying to make a loan calculator... im messing around with the code trying to get used to it so ignore the funny parts...


Dim PriceBorrowed As Single
Dim PeriodOfLoan As Single
Dim LoanAmount As Single
Dim SetLoanButton As String
Const Interest = 7

Dim TenThousand As Single
TenThousand = ("£10000")
Dim FiveThousand As Single
FiveThousand = ("£5000")
Dim ThreeThousand As Single
ThreeThousand = ("£3000")
Dim TwoThousand As Single
TwoThousand = ("£2000")
Dim OneThousand As Single
OneThousand = ("£1000")

Dim FiveYears As String
FiveYears = ("5 Years")
Dim ThreeYears As String
ThreeYears = ("3 Years")
Dim OneYear As String
OneYear = ("1 Year")

SetLoanButton = MsgBox("Choose the amount you wish to borrow", vbOK)
If SetLoanButton = vbOK Then

PriceBorrowed = InputBox("Please enter the amount you want to borrow")
PeriodOfLoan = InputBox("Please enter the period of your loan")
LoanAmount = PriceBorrowed * (1 + Interest / 100) ^ (PeriodOfLoan)

Button3.Text = "Your loan will be £" & LoanAmount

Else
MsgBox("Please use custom Loan Calculator")
End If
End Sub

i need to these as buttons, but i dont know how to make them into buttons...

Dim TenThousand As Single
TenThousand = ("£10000")
Dim FiveThousand As Single
FiveThousand = ("£5000")
Dim ThreeThousand As Single
ThreeThousand = ("£3000")
Dim TwoThousand As Single
TwoThousand = ("£2000")
Dim OneThousand As Single
OneThousand = ("£1000")

Dim FiveYears As String
FiveYears = ("5 Years")
Dim ThreeYears As String
ThreeYears = ("3 Years")
Dim OneYear As String
OneYear = ("1 Year")

I need to make them appear as buttons inside a MsgBox

I hope u all understand me, if theres a better way, im open to suggestions.

Thanks.
Flame is offline  
Old 11-07-2006, 05:10 PM   #2 (permalink)
arn
 
Newb Techie

Join Date: Nov 2006

Posts: 4

arn

Default

why dont you buy one (10 bucks) or seach online? whats your time worth, anyway?
arn is offline  
Old 11-07-2006, 06:20 PM   #3 (permalink)
 
Junior Techie

Join Date: Feb 2006

Posts: 53

Flame

Default

Lol sorry. should of explained myself. I started college not long ago doing software development. this is an assignment, im not asking anybody to do it for me im asking for a bump in the right direction to my question.
Flame is offline  
Old 11-08-2006, 06:45 AM   #4 (permalink)
baronvongogo's Avatar
 
Master Techie

Join Date: May 2005

Location: UK

Posts: 2,749

baronvongogo is on a distinguished road

Default

its been ages since iv done vb now is the msgbox the default windows one so not much can be set?

Or are you creating a new form that once clicked that opens in which you can then enter data.
__________________
baronvongogo is offline  
Old 11-08-2006, 06:12 PM   #5 (permalink)
 
Junior Techie

Join Date: Feb 2006

Posts: 53

Flame

Default

thanks for the reply

A MsgBox i believe is the defualt windows box, you can have options like yes or no by adding vbYesNo

a box were you enter data i believe is an InputBox

is there another type of box that i can have custem buttens? or does somebody that understands what im trying to do know how to do it?

Thanks.
Flame is offline  
Old 11-08-2006, 06:37 PM   #6 (permalink)
baronvongogo's Avatar
 
Master Techie

Join Date: May 2005

Location: UK

Posts: 2,749

baronvongogo is on a distinguished road

Default

why not just create a form? then have it pop up that way you could customise it with buttons, input boxes etc.
__________________
baronvongogo is offline  
Old 11-08-2006, 10:08 PM   #7 (permalink)
jesspren6's Avatar
 
Super Techie

Join Date: May 2006

Posts: 266

jesspren6 is on a distinguished road

Default

Why dont you dim all of your variables in your general declarations under the option explicit? And for example, wouldn't you want PriceBorrowed = val(InputBox("Please enter the amount you want to borrow")) instead of PriceBorrowed = InputBox("Please enter the amount you want to borrow"). I think your Msgbox has to be a label too, so you would have lblMsgBox.caption = MsgBox. I'm not sure if you can make ur values into the label (MsgBox), but you could make buttons and put those values, like 10,000 as the caption for a button...
jesspren6 is offline  
 
Closed Thread

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