View Full Version : Windows - VB .NET Help (asap)
Dec 12, 2006, 10:55 PM
I am desperately trying to convert numbers that I must use VB .NET (Obviously on Windows) to do and have no idea where/how to start. One "calculate" button will control all four conversions that will be run on the screen. A "reset" button will reset everything. Does anyone have any suggestions/tips on this? This is on VisualBasic .NET. Any help at all would be greatly appreciated. Below is what my final project must look like. (I have the front end of the app done, just not sure on the back code) Also, I need to have this done by Thursday and am clueless.:(
[Posted on behalf of brother (college, intro to programming course)]
Dec 13, 2006, 01:02 AM
How far are you on the form itself?
To accomplish the reset I would reset each of the txt boxes in the btnClick command....like so
txtBox1.text = ""
txtBox2.text = ""
and so on until you clear all of your text boxes or whatever you have them set as in VB.
I'm not really sure what you're asking in regards to the numbers...
A good start to it would be this...if I'm understanding you correctly
Dim CalcAcre as Single
Dim Arms-Length as Single
--- and so on until you have a dim for each conversion method....
txtBox1.text = "" -- to clear the text boxes... you may use names like txtAcre or something to easily differentiate between the different boxes
...so I would name them like txtAcre, txtPerch and so on....
and then I would put the equation for each is so
txtPerch.text = whatever the equation is to convert it....
and then just go down the line until you fill out all the conversions
I'm sorry that this description is really confusing but if you need me to elaborate on anything just quote me or something and I'll try to be more specific.
Dec 13, 2006, 07:37 AM
You didn't specify the order of conversion.. I'll assume we will convert from left to right but you may want to do it the other way around.
Or better yet do it both ways.
let's say your calculate button is called btCalculate
' just an event handler that will trigger the conversion
public sub btCalculate_OnClick(byval src as object,byval args as eventargs)
' this one is the real conversion code. I did not place it in an event handler so we can share the code with a menu item or a textbox OnTextChanged event handler for example.
public sub doConversion()
doArea() ' compute the area conversion
doDistance() ' do the distance conversion
doWeight() ' do the weight conversion
doForce() ' do the force conversion
public sub doForce()
if(not tbKib.Text = string.Empty) then
dim kip as decimal = Convert.ToDecimal(tbKib.Text)
dim newtons as decimal = kip * 4448.221
' icing on the cake: automatic conversion
public sub tbKib_OnTextChanged(byval src as object, byval args as eventargs)
doForce(); ' automagically convert when the text has changed.
ps: you made me type VB, you'll pay a dear cost for that... :D
Dec 13, 2006, 10:36 PM
Hey Guys. I am still really confused, I got the "Clear" button working though.:) I posted the VB file online, if someone could PLEASE take a look at it, it would be GREATLY appreciated. If you make a change to it, you can email it to me at email@example.com. I need to have this done by tomorrow and I'm totally lost. Once again, ANY help is appreciated (& thanks to the guys who posted above, I am just really confused by the code) (Also, I'm not asking you to do it for me, all I need is an example of how the code would be implemented on one of the text boxes.
Link to VB Project (http://www.kevinschaefer.net/vb.zip)
Dec 13, 2006, 11:04 PM
Check your email.....
Dec 13, 2006, 11:10 PM
Bubbasteve, I got your email but it says my version of VB is not new enough to handle it. :mad: Anyway you could copy & paste all the code into <code> tags and then I can copy it into the project? Or, was there more changed then just the code? Thank you SO much for your help.