visual basic help needed..

vanoskyj

Board Regular
Joined
Apr 20, 2004
Messages
54
I need someone to assist with a simple procedure for visual basic.net.

using Visual Basic.net code I need a sub routine that receieves an integer number any number that is passed to it. The procedure named halfnumber should be able to divide the integer by 2 and then display the result in the lable name numCentral. can anybody help this rookie

oh yeah this must be a sub procedure of a btncalc click event. and thanks alot.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Ask your teacher. :)

Anyway, how is the number being passed? From a textbox? Inputbox?
Also. Is the functions result an integer?

This example uses a number entered in TextBox1...

Code:
   Private Function halfnumber(ByVal number As Int64) As Int64
      Return number / 2
   End Function

   Private Sub btncalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncalc.Click
      numCentral.Text = halfnumber(TextBox1.Text)
   End Sub

Tom
 
Upvote 0
it has to be a sub routine not a function. and thanks for any and all help.

textbox is fine and yes result is integer.
 
Upvote 0
it has to be in vb.net form not excel, please. If i have 5 quarters coming in from a textbox I need 1 dollar and 1 quarter going out to each label (lblDollar.text) and (lblquarter.text).
 
Upvote 0

Forum statistics

Threads
1,223,277
Messages
6,171,149
Members
452,382
Latest member
RonChand

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top