Welcome to TheHotfix.net Forums
![]() |
Welcome to TheHotfix.net Forums, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of TheHotfix.net Forums by signing in or creating an account.
|
VB Script Help
#1
Posted 01 October 2009 - 05:16 PM
Thanks coders !!
#2
Posted 01 October 2009 - 05:19 PM
#3
Posted 01 October 2009 - 05:23 PM
Anyway, if I get the script I can change it
#4
Posted 01 October 2009 - 06:05 PM
#5
Posted 01 October 2009 - 06:13 PM
Its 15% for now - but always used to be 17.5% and will be back up there soon
#6
Posted 01 October 2009 - 06:18 PM
#7
Posted 01 October 2009 - 07:39 PM
Just out of intrest, are you going to be using the price entry thingy if someone finds code for it for the place you work at?
#8
Posted 01 October 2009 - 09:34 PM
#9
Posted 01 October 2009 - 09:37 PM
#10
Posted 04 October 2009 - 09:44 PM
#11
Posted 05 October 2009 - 12:00 AM
1) Use the default window that appears, drag it to fit your size
2) Use the toolbox to create all the input fields and buttons you want.
3) Name your input fields accordingly.
4) Double Click the button next to the input field for the % u want to control, and type:
int price; int vat = .15; int total; price = input_field_name->value; total = price*vat; total_price_input_field_name->value = total;
5) Repeat step 4 for all the other other input field/button combinations you want.
I haven't touched VB for a REALLY long time, but Line 4 & 7 should work. If not, I'm sure Diablo can correct my syntax.
Dave - why not make a web program for this? That way it can be mobile and you don't have to have any other VB dependencies, plus it is multi-OS. I can help you with a Web version of this, if you are interested.
#12
Posted 05 October 2009 - 03:39 AM
Your code is completely wrong ben. Right idea, wrong syntax though. It should beDave - go download Visual Studio Express from Microsoft, set the project VB, then do this...
1) Use the default window that appears, drag it to fit your size
2) Use the toolbox to create all the input fields and buttons you want.
3) Name your input fields accordingly.
4) Double Click the button next to the input field for the % u want to control, and type:int price; int vat = .15; int total; price = input_field_name->value; total = price*vat; total_price_input_field_name->value = total;
5) Repeat step 4 for all the other other input field/button combinations you want.
I haven't touched VB for a REALLY long time, but Line 4 & 7 should work. If not, I'm sure Diablo can correct my syntax.
Dave - why not make a web program for this? That way it can be mobile and you don't have to have any other VB dependencies, plus it is multi-OS. I can help you with a Web version of this, if you are interested.
Dim price as double Dim vat as float = .15 Dim total as float price = cdbl(input_field_name.text) total = price*vat total_price_input_field_name.text = "$" & totalI also agree with you ben, he should make it make it a web version. Unless he only plans to run this on like 1 computer, then it would be a waste.
#13
Posted 05 October 2009 - 10:53 PM
function calcVat()
{
var price = $("#price").val();
var total = "$"+price*.15;
$("#input1").val(total);
}
that would be the function for the onpress for the button. I'll make the entire program for you if you want.
#14
Posted 06 October 2009 - 01:15 AM
Your code is completely wrong ben. Right idea, wrong syntax though. It should be
Dim price as double Dim vat as float = .15 Dim total as float price = cdbl(input_field_name.text) total = price*vat total_price_input_field_name.text = "{:content:}quot; & totalI also agree with you ben, he should make it make it a web version. Unless he only plans to run this on like 1 computer, then it would be a waste.
OOH! I see now, I was remembering C++. Yeah...ok.. You're right. I don't/never liked VB, I always thought it was inferior. Haha!
#15
Posted 06 October 2009 - 06:31 AM
Thanks for the help, If I manage to make this easily, I might donate some of my life to learning VB !!
Thanks again!
#16
Posted 06 October 2009 - 11:01 AM
With jQuery, Dave, this would work:
function calcVat() { var price = $("#price").val(); var total = "{:content:}quot;+price*.15; $("#input1").val(total); }
that would be the function for the onpress for the button. I'll make the entire program for you if you want.
Im trying it myself too but yea that would be good if you made one too coz I cant see mine working lmao
Ok Im guessing I am supposed to change some code here?? To what, remember I am less than a newbie when it comes to programming
Edited by Dave, 06 October 2009 - 11:07 AM.
#17
Posted 06 October 2009 - 02:35 PM
Aw crap, I was remembering a bit of C++ as well. Those 'float's should be Decimals. Input field name needs to be the name of the text box where you enter the price. The total_price_input_field_name should be the name of the text box of where the price gets printed into.Im trying it myself too but yea that would be good if you made one too coz I cant see mine working lmao
Ok Im guessing I am supposed to change some code here?? To what, remember I am less than a newbie when it comes to programming
I agree with you. C++ is way more superior to Any .NET Language and Java. Mainly because of the sheer amount of control you have over the language and how it operates.OOH! I see now, I was remembering C++. Yeah...ok.. You're right. I don't/never liked VB, I always thought it was inferior. Haha!
#18
Posted 06 October 2009 - 09:50 PM
and the name of the text box where I enter the price can be anything I choose ?
and the same with the total_price_input_field_name... it can be whatever I choose ?
Is this right ?
----------------------
Dim price as double
Dim vat as decimal = .15
Dim total as decimal
price = cdbl(anything_I_like.text)
total = price*vat
anything_I_like.text = "{:content:}quot; & total
----------------
Edited by Dave, 06 October 2009 - 09:52 PM.
#19
Posted 06 October 2009 - 11:06 PM

And try this code:
__________
Public Class Form1
Dim price As Decimal
Dim vat As Decimal = 0.175
Dim total As Decimal
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
TextBox1.Text = price
Call totalPrice()
TextBox2.Text = total
End Sub
Public Sub totalPrice()
If RadioButton1.Checked = True Then
total = 'put formula to calculate +VAT @ 17.5%
Else : total = ' put formula to calculate -VAT @ 17.5%
End If
End Sub
End Class
__________
I think that should work, but I don't know what exactly the VAT buttons should calculate, so I've left that area commented so you can make your own formula.
Edited by someone64, 06 October 2009 - 11:10 PM.
#20
Posted 06 October 2009 - 11:37 PM
I've made a really quick and simple version of this that will work on any computer with an Internet connection (it uses jQuery which is hosted on Google.)
If you want to, I will make you a version that will work by itself with no Internet connection. Just say the words.
Here's the code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
//******************* DAVE: Edit params here. *******************//
var vat = .15; // Percentage in decimal form, please.
//******************* DAVE: Don't touch anything after this. *****************//
$(document).ready(function() {
var vat_p = vat*100;
$("#submit").val("Calculate with VAT at "+vat_p+"%");
});
function calcVat()
{
var price1, price1_vat, price1_total;
price1 = $("#price1").val(); // Get Price1 Value
price1_vat = price1*vat; // Get the VAT Tax for that price
price1_total = parseFloat(price1_vat)+parseFloat(price1);
if(isNaN(price1_total))
alert("Please enter a valid number.");
else
$("#total1").val(price1_total); // Write the total into input box.
}
</script>
<html>
<form name="vatPricer">
<label for="price1">Price:</label>
<input type="text" id="price1" name="price1" />
<input type="button" id="submit" value='Loading...' onclick="javascript:calcVat();" name="submit">
<label for="total1">Price after VAT:</label>
<input type="text" readonly="readonly" id="total1" name="total1" />
</form>
</html>
I could make it much prettier with some CSS, but that's it. If you want me to create two separate buttons that are +VAT and -VAT, tell me as well.
Here's the actual HTML file.
dave.html 1.21K
6 downloadsTo run it, just open it in the browser of your choice.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













