Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Simple FSO / Network Calculation


hello, I have developed a file uplaod system, I am trying to calcualte how long it will take to upload a selected file, i am doing this by getting the file size of the seleced file > converting the bytes to bits > then dividing by the network speed (100). My code below gives a "divide by zero" error..

ive prbaly got the calc wrong, any1 know?

thanks.


VB Code:
Dim cFileBytes As Integer    Dim cFileBits As Integer    Dim cNetowrkSpeed As Integer    Dim cResult As Integer            netWorkSpeed = 100        lstDrag.Clear    lstDrag.AddItem Data.Files(1)    cFile = Data.Files(1)    strFile = fso.GetFileName(cFile)    cFileBytes = fso.GetFile(cFile).Size        lblFileSize.Caption = cFileBytes & " " & "Bytes"        cFileBits = cFileBytes * 8            cResult = cFileBits / cNetworkSpeed        lblUploadTime.Caption = cResult




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Simple Calculation
Hi all.

Its been awhile. Anyway school decided to start programming and its using VB6. So I have been working on this program which will calculate the estimated time of a journey. The formulae should be: T=D/S.

That of course is easier said than done.I think.

So I just need it to take in 2 simple inputs: the estimated distance and estimated speed (avg). I wish to give it a simple output into a textbox. The coding is the only thing I at current are having difficulty with.

Thanks,
Colin.

Simple Calculation? Right?
I'm very much new to Vb and decided to create a basic program (Calculation). The code should work out the total number of "kills" required to gain a certain level/ amount of experince points in an online game. When I use the code I produced, it gives a "Mis-match" error. Anyone know why this is happening; and how I may solve this problem?


Code:
Private Sub Calculate_Click()
Dim Need As Integer 'Amount Of experince required
Dim XP As Integer 'Current experience
Dim Kill As Integer 'Experince gained per 1 kill
Dim Total As Integer 'Total number required to gain given experince

Need = txtneeded.Text
XP = txtcurrentexp.Text
Kill = txtexpperkill.Text
Total = txtTotal.Text 'The mis-match error occurs for this line

If cmdCalculate.Value = True Then
Total = (Need - XP) / Kill
End If
End Sub

Simple Calculation...
hi guyz....
If i have 4 sets of number and i want to pick the smallest number. How do i do that....

After choosing the smallest number, i need to divide all the number with the smallest number...

Eg. 3 8 2 9 --------> Choose the smallest number --------> 2
        
        3 8 2 9 ---------> all number with the smallest number---------> 1.5 4 1 4.5

iszit using get min?

Very Simple Calculation
Hi all
Very simple calculation and have got no clue.

Two txt boxes.(Unable to use three)
Text2 hold the default value that comes from a db
Text1 val changes by user input between 1-10

Text2.Text = (Text1.Text * Text2.Text)

Once the calculation is done the value in Text2 changes.

How can I use the the default val constantly to multiply with Text1?
Thanks
Pieter

Simple Calculation Problem
Hi guys,
An easy problem (I hope) for most people, but it's got me stumped. I have 3 cells K5 to K7 in which I have numbers. I also have K16 to K29, that also contain numbers. Inbetween the cells is information that I dont want included. I've tried using both the below forumals

=SUM(K5:K7)+(K16:K29)
=SUM(K5:K7)&(K16:K29)

But neither work and just give me the "Value!"

Where am I going wrong on this one???

Simple Data Calculation
I am trying to create a simple credit calculator that calculates the tax percentage, then it takes that percentage and multiplies it by the different shipping tiers we have, but for some reason, i cant get the values, to turn into actual money values, I did the Ccur but it dosent work


VB Code:
Option ExplicitDim num1 As DoubleDim num2 As DoubleDim num3 As DoubleDim num4 As DoubleDim num5 As DoubleDim answer1 As Double Private Sub Command1_Click()num1 = Text1.Textnum2 = Text2.Textnum3 = Text3.Textnum4 = Text4.Text answer1 = (num2 / num1)Text3.Text = answer1Text4.Text = (answer1 * num1) + (num1)Text5.Text = CCur(Text5.Text * answer1)Text6.Text = CCur(Text6.Text * answer1)Text7.Text = CCur(Text7.Text * answer1)Text8.Text = CCur(Text8.Text * answer1)Text9.Text = CCur(Text9.Text * answer1)Text10.Text = CCur(Text10.Text * answer1)Text11.Text = CCur(Text11.Text * answer1)Text12.Text = CCur(Text12.Text * answer1)Text13.Text = CCur(Text13.Text * answer1)Text14.Text = CCur(Text14.Text * answer1)Text15.Text = CCur(Text15.Text * answer1)Text16.Text = CCur(Text16.Text * answer1)Text17.Text = CCur(Text17.Text * answer1)Text18.Text = CCur(Text18.Text * answer1)Text19.Text = CCur(Text19.Text * answer1) End Sub 'Clear the ValuesPrivate Sub Command3_Click()Text1.Text = ""Text2.Text = ""Text3.Text = "0"Text4.Text = "0"Form_LoadEnd Sub Public Sub Form_Load()' Loading the values into the sections    Text5.Text = CCur(4.95)    Text6.Text = CCur(5.95)    Text7.Text = CCur(8.95)    Text8.Text = CCur(10.95)    Text9.Text = CCur(12.95)    Text10.Text = CCur(9.95)    Text11.Text = CCur(11.95)    Text12.Text = CCur(13.95)    Text13.Text = CCur(15.95)    Text14.Text = CCur(17.95)    Text15.Text = CCur(24.95)    Text16.Text = CCur(26.95)    Text17.Text = CCur(28.95)    Text18.Text = CCur(30.95)    Text19.Text = CCur(32.95) End Sub

Simple Calculation Standalone App
Hey guys,
I just ran into your forum site and would like to post a request. Don't know if Iwill get flamed or not for this. But I work in a small business and need to do these calculations on a very regular basis. Right now I am doing this manually, but I would like to get this automated and get a tiny app for this. If anybody would like to help, that would be deeply appreciated.

Thank you.

n= user input

if (n<=300)
i=((30*n)/100)

if (n>300&&n<=1000)
r=n-300
i=((30*n)/100)
i=i+((25*r)/100)

if (n>1000)
r=n-300
s=n-700
i=((30*n)/100)
i=i+((25*r)/100)
i=i+((20*s)/100)

print i

Simple Calculation Help Needed
Let me first start off by saying hi. Hi. Well, that was dull.

Anyway, I need some help assigning a value to a command button and putting that value in a text box. (the easy part) Then I need to press another button and add a specified number to the amount already in the text box. (or subtract, you get the idea).

Why can't I figure this out on my own? It's so simple that no VB resource I look at can tell me how to do it. I kid you not. I am an idiot.

Thank you for your help. Actual code would be helpful, but telling me a few basic functions is ok.

Simple Redirect Calculation ?
Hi, im trying to create a little script that redirect you to a page.

There is input box, if that box has the number over 250000 then it should redirect to page 1

if its under 250000 the it should redirect to page 2

here is my bad attempt at doing this

Code:


<%

dim intrecords2
dim intletter2
dim strRedirectTo1
dim strRedirectTo2



strRedirectTo1 ="(URL address blocked: See forum rules)"
strRedirectTo2 ="(URL address blocked: See forum rules)"
records2 = Request("records")
letters2 = Request("letters")

if records = < 250000
then
Response.Redirect strRedirectTo1
end if
else if records = > 250000
then
Response.Redirect strRedirectTo2
end else if

end function

%>


i design websites and my vb guy just has something big come up so i have to try this my self whoo hoo go the graphics designer

Thanks

Simple Calculation *RESOLVED*
Dear VBers,

I am working on VB 6.0(SP5) and Access 2003.

I have a form with a textbox (txtWeight) and a command button (cmdGO). When i click on cmdGO, the value inside txtWeight is supposed to be captured and stored inside the database. But i need to add 0.5 to the typed value.

Is there any easy way to do it rather than declaring another variable to store the value?



Edited by - marsulein on 1/27/2004 10:03:29 PM

Simple Division Calculation Problem
Hey guys, im having some trouble doing this very easy calculation.

The windows calculator says that 280 / 3600 = .077777777777777778
but
My vb program says its 7.7777778E-02 or soemthing like that.

How would i make it show me what the windows calculator shows me, instead of what it currently shows me in vb?

Simple Math Calculation *SOLVED*
It's been a long day so please bear with me. I've got 9 text box control arrays Text(0) to Text (8)) and I want to add the numbers I will be entering in them to display in another text box. Below is the code I've got set up but instead of getting the sum of the numbers it simple places them one next to each other.

5 + 5 should display 10 but instead it displays 55

Private Sub Command1_Click()
Dim i As Integer

For i = 0 To 8

tmp = tmp + Text1(i)
Next

txtScoreFr.Text = tmp
End Sub

Thanks,
Lintz

Data Bound Field Calculation And Restrict Decimal Places While Calculation In Code
Hi
I am working on a VB6 Windows application.
There are a lot of (40) numeric fields, the values for which I calculate in code but are not saved in database.

So is it possible to get the values calculated in a view (view could be reused in reports) while binding data. The values need to be recalculated in code on change of some other fields. So, what is a better approach. As we can't update the Bound textboxes in code, if the DataField property of the textbox is set, because the views are not updatable. Is there any better way of designing this.
Another Question is that i have the formula something like this for calculation:

txtTax.Text = txtCost.Text * Rate1/100
txtTotalAmt.text = txtCost.Text * rate2/100 + txtTax.Text

So the calculated value of Tax contains lot of decimal places. But i would like to have a precision of two decimal places, when its added to 2nd formula to calculate total amount. All the COnversion functions like Cdec, CSng , CDbl return lot of decimal places. So right now, i'm just formatting the tax value to
two decimal places and then adding to 2nd formula as shown below:

txtTax.Text = Format(txtTax.Text, "Fixed")
txtTotalAmt.text = format (txtCost.Text * rate2/100 + txtTax.Text,"Fixed")

Is this the right way for calculation or is there any other way of calculating to right precision?

Because using this method , if i'm again adding Total Amt with another similarly calculated value as shown below, it just appends them as string. eg. 100.00200.00
txtTotalAmt3.text = txtTotalAmt1.text + txtTotalAmt1.Text

So i used Val function:
txtTotalAmt3.text = val(txtTotalAmt1.text )+ val(txtTotalAmt1.Text ), which doesn't seems to be a good

approach.

Please help.
Thanks

Simple Network Connection
Hey, Im not entirely new to programming in VB, however Ive never had any proper training, and that makes things difficult, especially when I learn visually.
What I would like to know is how to establish a simple connection between to computers running the same program (for example a small stat game) Where connections can be started, and joined, (as in most games). And then send recieve contents of variables between the two programs.

Thanx for any help - MJMercer

Simple Network Connection
Hey, Im not entirely new to programming in VB, however Ive never had any proper training, and that makes things difficult, especially when I learn visually.
What I would like to know is how to establish a simple connection between to computers running the same program (for example a small stat game) Where connections can be started, and joined, (as in most games). And then send recieve contents of variables between the two programs.

Thanx for any help - MJMercer

Help On SNMP(Simple Network Management Protocol)
Hi Guys !

Can anyone refer me with some SNMP samples with Visual Basic.
Can we use SNMP trap with Visual Basic

Is it possible to develop NMS(Network Management System) using Visual Basic.

Looking for an early reply.

Naveen !!!!!!!!

How To Implement SNMP(Simple Network Management Protocol) In Vb
Dear Forum Friends

I Would Like To Know How To Implement SNMP In VB

Since I Am new to SNMP, I reqest any one of our friends to help me to know more

about SNMP and the way that it can be implemented in vb.

Please Help Me In Understanding how things get done if a protocol like SNMP is used.

Its really Frustrating going through This WWW For Answers.

Please Help Me.

Cheenu

Manual Calculation/auto Calculation
Hi

I'm using a set up where I use

CODE
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
END CODE

to stop my sheets calculating until I want them to.(Its the same as going into Tools, Options and clicking on the calculation tab and setting it to manual.)

But is there a way to action this line of code only when this workbook is opened, and then to execute the reverse when it is closed eg

CODE
With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
END CODE

This is because once I set it to manually calc it does the same for all subsequent work books I open meaning the autosums and other formula dont work on other workbooks unless I calculate (F9) them. The reason I only want this particular workbook to only calculate when asked is because it is so very very big with so very many functions on it and this speeds it up hugely as it keeps repeatedly calcing otherwise.

many thanks.

Be

Vba/network Printing Problem Accross A Network
I have a problem with printing to a network printer using vb6 to update a template with vba code. The program opens the template document , enters some text using bookmarks then opens the print preview screen. The user can then print or exit the document. If the user chooses to print when there is a large amount of network traffic an application busy error occurs (switch to .....). I think the problem is that the program doesn't have enough time to print before it tries to shut the word application down. I have tried putting timouts in but still has the same problem. Im not sure if the code is wrong or what???

Any ideas would be very much appreciated

Here is the relevant code.

------------------------------------------------------------
Set oWord.App = CreateObject("Word.Application")

If oWord.App Is Nothing Then
Set oWord.App = New Word.Application
If oWord.App Is Nothing Then
MsgBox "Sorry, Microsoft Word 2000 is required for this report"

End If
End If

With oWord.App
.Visible = False
'Opens ColdEnd Template file

.Documents.Open (clsMyAppPath & "ColdEnd.DOC")

--------------------------------------
"document updated here via bookmaks"
--------------------------------------

If .Application.PrintPreview = False Then
.ActiveDocument.PrintPreview
End If
.Visible = True
While .Application.PrintPreview = True
Do While .Application.BackgroundPrintingStatus > 0
'Sleep 1000
Loop
Wend
.Visible = False

DocName = clsMyAppPath & " emp" & "Temp_" & CurrentRun.RunID & ".doc"

.Application.ActiveDocument.SaveAs FileName:=DocName
.Documents.Close
.Quit
End With

Set oWord.App = Nothing
Set CurrentDepartment = Nothing
Set ComparatorDepartment = Nothing
------------------------------------------------------------

View Network Computers And Folders On The Network (not Sure If Possible)
Hello, I am new to this forum. I have a program where when i click a button, I want it to show the computers on the network. when they double click the computer, I want it to expand and show all folders in it, like a common dialog box, but can not use a common dialog box. Anyone know how to do this? I am not sure if you can.... Thanks in advance

Chris

Network Neighbourhood - Entire Network
Hello there,


I need to view the computers in the Intranet from VB application. Is there any control or API? Please help


Thanx...

Network Places And Network Computers
Hi.
How can I open a file in another computer on the local network ?
Thanks !

Network Path Or Network Names
Is there anyway to automatically get the network path of a folder on the computer an app is running on? Or at least is there anyway to get the name of a computer and what the folder or any of its parents are shared as?

I'm making an app that has local files it has to work with but I want it to work over the network to.. so I need to be able to specify to the the app when its running over the network to use the network path instead of the local path.

Thanks for any help

Network Monitor Or Network Meter?!
Anyone know how I might go about building a network monitor that monitors traffic inbound and outbound from the network adapters in my computers. I want to put it into a graph and have it update every second and look kinda like Task Manager.

Operating Network Machine Using Vb On Network
In my Organisation, while using InoculateIT (virus software) i have seen very interesting thing. sitting on one computer, the User can connect to Another computer on Network (The list of Network Computers will be displayed in a Window ). The Desktop of the connected computer (on network) will be displayed on the Host computer in a saparate window & the User can access the other computer's desktop as he is literally sitting on that computer & operating it. User can Double click on icons on desktop of the connected computer, he can Access 'Start' Button of Task Bar to Perform Various of Operations of the Remote Computer.
I am seeking HElp on how it would have been done & whether it is possible to do the same using VB 6.0.

Sharing Network Drive On Network
I want to share my "C,D or E" drive programmatically having win2000 or winnt 4 as operating system.
So any one knows any way through which i do this tell me (weather by registry or by some dos command
which runs in winnt or by the help of vb)
I also want to set rights and users which i want to give access of my shared drive.

Bit Calculation Help
I wantto produce cinema seat reservation system, which allows for checking availabilty, making seat reservation for any of its forthcoming event, calculating the payment for reservation and handling cancellation.
The seats are available in 2 categories

400 End -Seats, ticket price £20
600 other seating, ticket price for each £25.50

The following discounts apply
Pensioner 10%
child 50%
10 or more tickets 3%

I have done the saving customer account, and seat availability thing, but could't handle the price calculation and customer deletion bit.
Please help me in it.
My programe is given below:

Type Customer
sSurname As String * 15
sForename As String * 15
dDoB As Date
sSeat As Single
sSeatArea As String * 15
End Type




Private Sub SubBtn_Click()
'TotBPTxt = "£" & Val(Str(25 * 10 * Val(PenTxt.Text) / 100)) + Val(Str(25 * 50 * Val(ChildTxt.Text) / 100)) + Val(Str(25 * Val(AdultTxt.Text)))

Dim seat As Customer 'WHY I HAVE TO DOUBLE DEFINE IT,(1) IN FORM LOAD & (2) HERE

Open App.Path & "stadium.txt" For Random As #1 Len = Len(seat)

If SNameTxt.Text = "" Then
MsgBox "Please enter customer's Surname"

ElseIf FNameTxt.Text = "" Then
MsgBox "Please enter Cutomer's First Name"

ElseIf DOBTxt.Text = "" Then
MsgBox "Please enter customer's date"

'If DOBTxt.Text! = Date Then
'MsgBox "Please enter the customer's RIGHT Date of Birth"

'ElseIf SeatTxt.Text = Text Then
'MsgBox "Please enter valid seat number"


Else




Get #1, Val(SeatTxt.Text), seat



If seat.sSeat = Val(SeatTxt.Text) Then
MsgBox ("Sorry, seat already booked")
Else
seat.sSurname = SNameTxt.Text
seat.sForename = FNameTxt.Text
seat.dDoB = DOBTxt.Text
seat.sSeat = Val(SeatTxt.Text)
Put #1, seat.sSeat, seat
End If
End If

If SeatTxt >= 1 And SeatTxt <= 400 Then
seat.sSeatArea = "End Of Stadium"
txtSeatArea = "End Of Stadium"
Else
seat.sSeatArea = "Other Seating"
txtSeatArea = "Other Seating"
End If


Close #1

SNameTxt.Text = ""
FNameTxt.Text = ""
DOBTxt.Text = ""
SeatTxt.Text = ""
SNameTxt.SetFocus

End Sub

Calculation Within Vb
i have to create a program that uses the input box function. it has to allow a sales person to enter as many sale amounts as they want, then when the calculate button is pressed, calculate A 10% bonus of all sales...

I am having trouble getting started on this...

Any Ideas

Thanx in advance

Age Calculation
In Access I have a table containing people's date of birth. I want to calculate their age from it and tried it this way:

DateDiff("yyyy";[Date of Birth];Now())

This however does not produce correct results, since DateDiff with the option "yyyy" simply returns year1 - year2. For example, if [Date of Birth] would be the 1st of December, 2002, then this function returns 1. The age of this child would however be 0 years and not 1 year.

Can anyone help me out how I could calculate the exact age (in years) from someone's date of birth?

Thanks a lot!

Jochen

Calculation
Hi,
I've just starting learning VB yesterday and I've looked around and experimented in a multitude of different way, but I just can't get past this problem, maybe I'm doing it completely wrong. I thought I would be able to learn VB well by making a basic game, just the relaying and calculationg of number basically.


Code:
Private Sub CmdCalc_Click()

Const thirty = 30

Dim Str As Integer
Dim Dex As Integer
Dim Itl As Integer
Dim Spt As Integer
Dim Stat As Integer

TxtStrength.Text = Val(Str)
TxtDexterity.Text = Val(Dex)
TxtIntellect.Text = Val(Itl)
TxtSpirit.Text = Val(Spt)
LblStat.Caption = Val(Stat)
LblThirty.Caption = Val(thirty)

Stat = (Str + Dex + Itl + Spt)

LblPoints.Caption = thirty - Stat
End Sub
My aim was to add together 4 numbers that a user would input, which would then be taken away from the allocated amount of points allowed (30).

I'd really appreciated any modifications or any changes if it's wrong,
Thanks a lot

Calculation
Hi

If you have a label caption which reads (2x3)+4 is it possible to calculate it and have the answer tagged on the end. i.e. (2x3)+4=10.

I know how to do the last bit, its getting the answer that's the problem. I also realise that 'x' means nothing and needs to be *.

By the way, the digits and signs are entered using a keypad of labels like a calculator. Its an activity for a school interactive whiteboard.

Cheers

Calculation
What would be the best way to perform calculation.

The calculation is done on a string like this one:

"64 + 48 / (15 -7) * 51.215"

Any ideas are welcome

Thanks.

Yet Another Calculation
well im making this program to generate random math problems. and there is this one math problem type:

123n * 9 + (n+1) = (n + 1) 1's

example:

Calculation
Code:
debug.print (0.7553 - (413 / (515.7159091))) * 3 ^ 0.5 * Log(72) - (1.854 - (1042 / (515.7159091))) * 3 ^ 0.5 + ((2416 / (515.7159091)) - 2.013) * Log(72) - (8742 / (515.7159091)) + 15.64

When I execute this formula in an Excel cell the result is : 3.793042649

But when I execute the same formula in a vb module then the result is : 10.0661137202961

Any ideas why there's a difference...

Thanks

Calculation In SQL
Need help in calculating! First of all, I have a database called db1.mdf that has " table1" and has a column for "fuelqty" , "cost"and "Mileage" (number of of mileage). I need to implement the specified data analysis capabilities (cost per mile, and miles per gallon) using SQL queries to retrieve the data from the database. I was told that I should use the following:

(last_fuel_odometer – starting_odometer) / (total_fuel_used) for calculating average miles per gallon and

Total_operating_cost / (current_odometer – starting_odometer) for cost per mile.

Now, not knowing much about SQL (actually 0), what is the best way to approch this. If anyone has a sample code I would greatly appreciate this. I have finals next week and I'm sure this will come up.

Thanks!!!

Calculation Help
Below is the code that i'm trying to fix so that it gives me accurate numbers for the days, months and years between 2 set dates. Please help


Code:
Public Sub T()
Dim y As Integer, m As Integer, d As Integer
Dim dteStart1 As Date, dteEnd As Date
Dim dteStart2 As Date, Today As Date
Dim days1 As Integer
Dim days2 As Integer
Dim months As Integer
Dim years As Integer

dteStart1 = "1/1/04" '8/9/99"
'dteEnd = "4/27/01"
'dteStart2 = "11/11/02"
Today = Now

days1 = DateDiff("d", dteStart1, Today) + 1 'dteEnd)...includes today as a day gone by
'days2 = DateDiff("d", dteStart2, Today)
months = (days1 / 30.4) '+ (days2 / 30.4) '365 days divided by 12 months = 30.4 days

If months >= (years * 12) Then
months = months - (years * 12)
If months < 12 Then
years = years - 1
End If
End If
years = (months / 12)

Debug.Print days1
'Debug.Print days2
Debug.Print months
Debug.Print years

End Sub

Calculation Help
I am working on an assignment, and I am to calculating and I cannot figure it out. Below is what i need to do:

This is what I really need to figure out:
•Accumulating a candy: Add code to the Add button to update all aspects of the ListView every time it is clicked. The code must also update the selection of the leading color so that the StatusBar will display correct results.


Purpose:Application Purpose: Characterize the color distribution of candies in a package of M&Ms.

Assessment Purpose: Provide experience with:
•The collection editor
•Looping through collections with For-Each
•The ListView control
•The StatusBar control
•The Timer control
•The Anchor property

Algorithms:Count = running total
Percent = Count / Sum(Count) expressed as a percentage
Elapsed Time = # seconds since the form was activated
Notes: Application Parameters:

•The user selects a candy color one at a time and tells the computer to count it when the Add button is clicked.
•(need to figure out how to count and do percentage)Color distribution data needs to be presented in a tabular form. List each color that appears along with how many candies have that color (so far) and how large a percentage of the total sample has that color.
•(done)Remove all data from the table when the Reset button is clicked.
•1. (done)Keep track of elapsed time 2. and the leading candy color. Of course, the leading candy color also needs to be reset when the Reset button is clicked.
•(done)Make the application rugged with respect to window resizing.

Vb 6.0 Sum Calculation
im havin trouble addin a total from a text box to a label.
i want to type in the amount in the text box, for example "50", and when I click on TRANSACTION on the menu bar, I want the "50" to show on the lblBalance Label. Then I wanna add "25" to that "50", so i type in "25" in the text box, and click TRANSACTION I want the amount to be"75" in the lblBalance. this is what i have so far, its not working.

[vb]Private Sub mnuFileTransaction_Click()
'Calculate transaction

Dim curAmount As Currency
Dim curBalance As Currency

'Convert input to values
curAmount = Val(txtAmount.Text)

'Find the Sum
If optDeposit.Value = True Then
lblBalance = Val(txtAmount.Text)

End If
End Sub

Could someone help me out... im stuck

Calculation Of Age
Could you please give me the instructions for working out the correct age of someone. I currently have a DateDiff function which is working out the age this year but it would be more beneficial if it worked out the exact age of the person.

Thanks in advance.

About XOR Calculation
i have a XOR code :

Code:
intXOrValue1 = Asc(Mid$(DataIn, lonDataPtr, 1))
'The second value comes from the code ke
' y
intXOrValue2 = Asc(Mid$(CodeKey, ((lonDataPtr Mod Len(CodeKey)) + 1), 1))
strDataOut = strDataOut + Chr(intXOrValue1 Xor intXOrValue2)


when my value1 = "a" and my value2 = "XO" , i get "." can anyone teach me
how to get "." ?

i know "a" = 01100001
but in this case "XO" does it mean "X and O"??

please replay asap. thank you

Calculation?
how do you calculate Yearly Salary and Hourly Wage using two command buttons and textboxes? yearly salary has its own cmdbutton and hourly wage has its own

Calculation
Hi,

How do calculate this in VB6

" 20 - 14.2559 % "

--
Adnan,

Calculation Help
I Have 7 Labels which i call them


EnterName
Enter number of pieces
Average
Money per person
Total Pieces
Total Amount of money
Amount Earned



and the rest are textBoxes all to calculate the above 7 labels to get the answers


Eg 1. I have to enter name
2. Number of pieces
3. Then it will be validate the name and pieces i have give them

Help! Calculation
Scenario: Boggs Inc: wants an application that will allow the user to enter the inventory number, quantity, and price of each item in inventory. Then application should allow the user to record this information in a sequential access file. In addition, the application should allow the user to print a report showing the inventory number, quantity, and price of each inventory item as well as the Average price:

Inventory# | Quantity | Item Price
_____________________________________________
ABC12 | 100 | 10.50
XYZ35 | 50 | 15.99
KLK25 | 150 | 20.00



I'm having a hard time figuring out the Average......Please help I'm very new to this.........Thanx in advance

Calculation In Vb.Net
THE PROBLEMS at the bottom of the page, thank you in advance for your time reading this, and i hope you can help btw im new so hello to all of you and i hope in the near future i will be able to help someone as you may to me thank you

Hello, was wondering if anyone can help me, well my task is to create a programme for a rental company that lends out playstation, dvd and videos. entering a product code such as D13456 and V23456 and P23456 so on ( only 12, 4 of each) and adding the prices up into a text box. I have this code so far.


Quote:





Dim counteritem As Integer
Dim counter As Integer
Dim myvar As String
Dim num As Integer
Dim D As Double
Dim P As Double
Dim V As Double
Dim iprice As Integer
Dim itotal As Double

CALCULATION BIT THAT NEEDS SORTING OUT:
Private Sub cmdcal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcal.Click
counteritem = lstboxpric.Items.Count - 1
For counter = 0 To counteritem
myvar = lstboxpric.Items.Item(Int(counter))

If myvar = D Then
num = D
itotal = itotal + num
BVAT.Text = "£ " & itotal
End If
If myvar = V Then
num = V
itotal = itotal + num
BVAT.Text = "£ " & itotal
End If
If myvar = P Then
num = P
itotal = itotal + num
BVAT.Text = "£ " & itotal
End If
Next
itotal = 0
End Sub

'This is the prices D = dvd V = video P = Playstation the prices are followed after the equals

Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
D = 3.25
V = 2.55
P = 1.55
End Sub

'This is the values that are added in the list box ready for calculation.

Private Sub cmdadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdadd.Click
lstboxname.Items.Add(lbl1.Text)
If lbl2.Text = 3.25 Then
lstboxpric.Items.Add(D)
ElseIf lbl2.Text = "2.55" Then
lstboxpric.Items.Add(V)
ElseIf lbl2.Text = "1.55" Then
lstboxpric.Items.Add(P)
End If
End Sub






My problem is that all the adding works so that if the 3.25 and 2.55 are in the lstboxpric the BVAT.text would come up with £6 instead of being£5.80 (i no for definate that it is rounding the sums up i have tried so many times) can any one see what i am doing wrong .. thank you so much for reading this i appreciate it .

I think thats correct so far anyway :/

much appreciated

cheers

CRC Calculation
Hello!

I want calculate 16 bit / 2 byte CRC for the following string.

02 6c 00 01 00 64 00 00 d5 00 00 00 01 00 02 47
61 6e 65 73 68 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
20 20 20

From another application, the CRC calculated is :
ae dd

How do I arrive at the same CRC with my coding?

Any Help?

Calculation
I have two variables: code is in asp:

intOrderQuantity
intOrderSupplied

The values of the variables are..
intOrderQuantity=4.14
intOrderSupplied=4.14

Validation is:

if cdbl(intOrderQuantity) > cdbl(intOrderSupplied) then
'do xyz

end if

It goes inside this condition..why???
If i remove cdbl then also it goes inside the if condition...

But, when I do
Cint(intOrderQuantity)>Cint(intOrderSupplied) then
'xyz
end if

then it works fine.ie it does not go inside. Also it works fine when i typecast to CSng..but not CDbl..why???

Calculation
I am doing some calculation in the program . But I am getting the numbers as fractions. I have to convert them to real numbers.
Is there a built in function in VB that converts real to fraction and vice versa.
example I have 0.8 .. and its the same as 8/10

Calculation
do we have to use Val to calculate the values in textboxes?

I have 2 textboxes, (text1 and text2) and a command button (cmdCal)
If I put this code in cmdCal:

msgbox val(text1.text) - val(text2.text)

it works fine. But if I put this code in the lostfocus event of the textboxes:

Private Sub Text1_LostFocus()
Text1.Text = Format(Text1.Text, "###,###,###")
End Sub

Private Sub Text2_LostFocus()
Text2.Text = Format(Text2.Text, "###,###,###")
End Sub

Then when I click cmdCal, the value isn't correct. For example in text1 I put 10000 and in text2 I put 2000, then the result is 8 (not 8000). But it works fine if I don't use Val.
Can there be errors if I don't use Val?
thank you very much

Copyright © 2005-08 www.BigResource.com, All rights reserved