Jump to content

Vb calculator help


RSBDavid

Recommended Posts

Dim monsterxp As Integer 'declare variables

Dim amount As Integer



Private Sub Command1_Click()

   monsterxp = Text1.Text     'copy text box values to variables

   amount = Text2.Text

   Text3.Text = 4 * amount * monsterxp 'calculate and output in the text box

End Sub

 

 

 

kinda crude way of doing it but since im assuming your the only one using it, it should work (dont enter 0's or letters ;)) you may also have to rename the text boxes depending on how you set it up, just use something that explains what they are better than i did

Link to comment
Share on other sites

to added to cem22lp's post.

 

Private Sub Button1_Click()

  'Declare your variables

  Dim MonsterExp as integer

  Dim Amount as integer

  Dim TotalExp as double

  'Check they have only entered numbers in the textboxes

  if isnumeric(textbox1.text) and isnumeric(textbox2.text) then

     MonsterExp = textbox1.text

     Amount=textbox2.text

     TotalExp=(4 x MonsterExp)*Amount

     textbox3.text=MonsterExp

  else

     msgbox("You must only enter numbers into the textboxes")

  End if

End Sub

 

If you add a picture box to the form and then double click the picture box it should give the option to add a image to the picture box

[hide=Drops]

  • Dragon Axe x11
    Berserker Ring x9
    Warrior Ring x8
    Seercull
    Dragon Med
    Dragon Boots x4 - all less then 30 kc
    Godsword Shard (bandos)
    Granite Maul x 3

Solo only - doesn't include barrows[/hide][hide=Stats]

joe_da_studd.png[/hide]

Link to comment
Share on other sites

Never put your output (answer) in a textbox. It makes no sense, just use a label. It's probably not working because you need to change the names of the things on your form to match the code exactly.

 

 

 

Post the code here.

Link to comment
Share on other sites

It would help if we had the code you wrote, so that the code we right will be formated to it and all you have to do is copy and paste. And if your thinking about including it on a web page your going to want it written in vbscript or better yet javascript. Vb script only works on IE explore, even firefox can't understand it, and since there so simaler always use javascipt.

 

 

 

Though if you just want to run this on your pc visual basics fine.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.