Need help with visual basics

Status
Not open for further replies.

Flame

Baseband Member
Messages
53
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.
 
why dont you buy one (10 bucks) or seach online? whats your time worth, anyway?
 
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.
 
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.
 
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.
 
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...
 
Status
Not open for further replies.
Back
Top Bottom