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




Checkboxes And Adding Values


Hi Guys,

Working on VB6 on a form:

on my opening form (frmintro) the users can choose to either have breakfast, dinner or lunch and this is done using checkboxes named chkBreakfast, chkLunch and chkDinner.

Now there are three companies ordering these meals, so what I want to do for example is that when a user from Company_A (chosen via a listbox lstCompany) orders Breakfast and Dinner the Values are added together (Breakfast £3.50) and Dinner (£5.00) and this information is displayed on another form (FrmTotal)

The total of these values are then held in memory so that when another person from the same company comes along and orders Breakfast and Dinner the total bill for the company is calculated (ie £17.00).

Not sure at all where to start on this – can anyone help?


Ta

reb




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Combining Several Checkboxes Values
I've figured out, in my roundabout way, how to assign a value to an Outlook Forms check boxes. Currently, there are 6 boxes the user can check. Any number from none to all 6 can be checked. What I'm doing is if they check the box, it puts a value in the correct column on my worksheet. So, in essence, I have 6 columns to house the 6 choices. It looks kind of shabby though. What I would like to do, is combine the values, maybe seperate them by a "-", and put that in one column. But I would like to do that through code, not through formulae. Does anyone know if this is possible?

Here is the part of my code that assigns the values:


Code:
If MItem.UserProperties("TrCertBox").Value = True Then Cells(NextRow, 3) = "TrCert"
If MItem.UserProperties("StarsBox").Value = True Then Cells(NextRow, 4) = "Stars"
If MItem.UserProperties("MastersBox").Value = True Then Cells(NextRow, 5) = "Masters"
If MItem.UserProperties("CustViewBox").Value = True Then Cells(NextRow, 6) = "CustView"
If MItem.UserProperties("MedEliteBox").Value = True Then Cells(NextRow, 7) = "MedElite"
If MItem.UserProperties("OtherBox").Value = True Then Cells(NextRow, 8) = "Other"

Initially, I had gotten this:


Code:
If "TrCertBox" Then Cells(NextRow, 3) = "TrCert"
If "StarsBox" Then Cells(NextRow, 4) = "Stars"
If "MastersBox" Then Cells(NextRow, 5) = "Masters"
If "CustViewBox" Then Cells(NextRow, 6) = "CustView"
If "MedEliteBox" Then Cells(NextRow, 7) = "MedElite"
If "OtherBox" Then Cells(NextRow, 8) = "Other"

to work, but I accidently deleted the workbook without saving...(wow was I mad), and I couldn't get the above part to work again. I had to resort to the longer version...oh well... :-/

Anyway, thanks for any help!!

Dave M.

Storing Values - Checkboxes
Hi I have 8 checkBoxes in an array ( chkOption(0) to chkOption(7) )

What I'm trying to do is check the boxes I need then somehow save the values of each in the start of cmdRun of which ones i've just ticked

Than when I have ran my program and the values get changed I can click cmdReset and it puts the ticks back in the correct boxes that I had ticked before I pressed run

Any ideas on how I can achieve this and store the original values of the checkboxes?

Thanks in advance

Allow Changes In Predefined Values In Checkboxes
I am trying to get the following to work:

1. I have defined variables to perform a calculation. Depending om the choices made, some of the variables are included in the calculation by checkboxes:
ex.
If Option1 = True Then
chkBox1 = 1 ('The value is included in the calculation)
...
If Option1 = True Then
chkBox2 = 0 ('The value is not included in the calculation)

etc.

2. I want to allow the user to enter a form (frm.changeval)
and check or uncheck options depending on the values the user wants to include in the calculation.

3. As the user exits the form by clicking "ok" and then "ok" in the msgbox to confirm, I want the changes to be "stored" so that if the user once again enters frm.changeval, the choices made last time still stands.

I know this is not the best explanation, but I hop it will do.

Hope someone can help me!

Humpty

Storing Checkboxes Values In Powerpoint
Someone told me there was a way to store a checkbox value in a powerpoint presentation with these things called active presentation tags....

Does anyone know how to do this?

Thanks

Nightfox02

FlexGrid And Checkboxes (boolean Values)
Can you put a checkbox in a boolean column in a FlexGrid? If not, is there any other Grid structure (non 3rd party), that supports this, as well as databinding?
TIA,
Andrej



Edited by - Andrejko on 6/18/2002 12:45:14 PM

Adding CheckBoxes
Is there a way to add CheckBox and ToggleButtons with out recompiling?

What i am trying to do is make a inventory program that when we get a new item TYPE that an admin can come in and have a control pannel that allows them to add as many CheckBoxes and DropDownBox as they like.

(The Admin will not have the option to control where the listbox or the checkbox goes)

I hope that made sence!

Thanx

Please Help.. How Can You Save Values Of All Checkboxes To Registry, && Retrieve Them?
Heres the code im using to save values of all checkboxes into the registry..

VB Code:
Dim x As ObjectFor Each x In Form1    If TypeOf x Is CheckBox Then        SaveSetting "ProjTest", "Settings", x.Name, x.Value    End IfNext x

and heres the code to retrieve the values

VB Code:
For Each x In Form1    If TypeOf x Is CheckBox Then        x.Value = GetSetting("ProjTest", "Settings", x.Name, 0)    End IfNext x

however, if the checkbox is an array, then the code will not work, because the naems of Check(1), Check(2) and Check(3) are all "Check"..

anyone have a method of saving and retreiving the values that will work with arrays too?

I guess what you can do is save the index as well (ie save x.Name & "," & x.Index") and then when retreiving values use split to apply the settings... but im not sure how to do that part

anyone know?

Checkboxes And True/false Values **RESOLVED**
I am trying to do something that I believe is complex in Access: I want to have a checkbox. When checked, it should put the value "true" in a particular cell of a different table. When unchecked, it will put "false" into that cell.

My problem occurs when I try to write the code for this. I am not sure how to tie these together in the proper manor. How do you make a checkbox in a form determine the true/false value of a certain cell in a table?

Also, what is the syntax for calling a particular cell? r:c? r#c#? rc? r,c? [r][c]? how?


- bungee41


Edited by - bungee41 on 3/11/2004 2:36:41 PM

Adding Checkboxes To Database
I have 2 checkboxes 1 and 2. I need for them if clicked to save a 1 in a access database and a 0 if not checked. Please someone help me with the code. thanks.

Adding Checkboxes At Runtime
Hi,

I want to add some check boxes to a form at runtime in the form load event.
Can u please help me out.

cheers,
vinay

Dynamically Adding Checkboxes
I need to insert checkboxes at runtime. How can I do this. The checkboxes
need to be inside a frame.

Adding "Check All" To ListView With Checkboxes
Hi Guys..

Do any of you know how to add a "Check All" option to a Listview with check boxes ?

Really appreciate your help.

Hemang

Adding Values
Is there a way to take the existing value from the registry and then add another value to it:

This is a Public Sub in a module and it is called in the main code when needed:


Code:
Public Sub WriteToReg()
Dim nBufferKey As Long, nBufferSubKey As Long
Dim nBufferDATA As String
Dim PointsTen As String

If Form6.Label30.Caption = "7" Then
RegQueryValueEx nBufferSubKey, "Points", 0, REG_SZ, nBufferDATA, Len(nBufferDATA)
PointsTen = nBufferDATA + "10"
RegOpenKey LOCALMACHINE, "SOFTWAREVisualBasicApps", nBufferKey
RegOpenKey nBufferKey, "HP", nBufferSubKey
RegSetValueEx nBufferSubKey, "Points", 0, REG_SZ, PointsTen, Len(PointsTen)
Form6.Hide
Form6.Timer1.Enabled = False
Form6.Label3.Caption = "90"
Else
MsgBox "You have FAILED!", vbInformation, "Failed!"
RegOpenKey LOCALMACHINE, "SOFTWAREVisualBasicApps", nBufferKey
RegOpenKey nBufferKey, "HP", nBufferSubKey
nBufferDATA = nBufferDATA - 2
End If
End Sub

This module is called:


Code:
If Label30.Caption = "7" Then
MsgBox "You have PASSED!", vbInformation, "Passed!"
List2.Clear
Text1.Text = ""
Call WriteToReg
Me.Hide
End If


Thanks in advance for any help,


~Jordan

Adding Up Some Values
I have got a worksheet that looks like this

Location | Number1 | Number2 | Number3

123 A | 12 | 15 | 24
145 B | 42 | 23 | 34
167 D | 12 | 15 | 12

Now i want to add up the values in "Number3" if "Number1" is the same.
The rest of the row can be deleted.

So it should look like this:

Location | Number1 | Number2 | Number3

123 A | 12 | 15 | 36
145 B | 42 | 23 | 34

Anyone know how to?

I do have a sort button that sorts the rows by Number1 if that helps.

Thnx in advance

Adding Two Values Together
ok, im trying to add the values of these two things

public pizzaprice
public toppingprice

i have a value added to each of them when i select a pizza and when i select toppings, odviously to two seperate public functions stated above.

I have three seperate forms, i public'ed pizzaprice and topping price on form1.

I want to know how i can add these values together in form 3

tahnks

Adding Values
I have an array of text boxes that hold number values. I want to get the total of these values added together with a click of a button. Does someone know an easy way of adding all of the values?
Totaltxt = Text1 0 To 10?
Thanks for any help.

Adding Values
i have a data base which has a unitprice field... my question is how can i add all the values in those field and place it in a label??? help please.....

Adding Values To .txt
Heres the problem,

I need to open an existing .txt file and add a new line to it.
The value of that new line must be strNewLine, and it must be over top of the old content of that txt file.
Any ideas?


Thanks in advance,

Adding Values
I enter 'n' number of values in a multiple line text box. How can I add all these values. Is text box OK or should I use some other tool

Thanks

Adding Values In A Column
Hi there.
I got a series of integer values in a column (e.g. b2:b40) in a worksheet of excel. I want to use vba script in excel to sum up the values and put the sum into a cell (say c40). I have tried:
ctr=40 (get from a loop by scanning the cell <> " " from b2)
sum_score = Sum("b2:b" & ctr)
Sheets(1).Range("c" & ctr + 1) = "Total score: " & sum_score

But the script failed to do so. Any advice please?
Cheers.

Adding One Ranges Values To Another
Hello,

I have some code that adds one range's current values to another range's values, and places tham back in the original range.

Like this:

Range("G23").Value = Range("G23").Value + Range("K23").Value
Range("G24").Value = Range("G24").Value + Range("K24").Value
Range("G25").Value = Range("G25").Value + Range("K25").Value
Range("G26").Value = Range("G26").Value + Range("K26").Value
Range("G27").Value = Range("G27").Value + Range("K27").Value

.....and so on.

I want to use one line of code to do that all at once.

like:

Range("G23:G27").Value = Range("G23:G27").Value + Range("K23:K27").Value

but this does not work. Can anyone help me?

Thanks in advance.

-Krys

Adding (+) Values In Two Comboboxs
Hi,

I have two combobox's that have numeric values in them (0,1,2,3). What I want to do is added these values together, example:

Combobox1 Value = 1
Combobox2 Value = 2

Commance button is pressed and textbox1 would equal 3.

At the moment the value I am getting is 12, it seems that VBA is simply putting the values together rather than "adding (+)".

Any help on this matter would be greatly appricated.

Rgds,
Daniel.

Need Help Adding The Values Of An Array
I am very frustrated with this!

I have an application that requires a user to enter a code into a text field
A function in my program then needs to add all the digits to one final value and set a variable equal to that.
The code would be in this format:
1524614544554
(Just a string)

Any suggestion on how i would do this would be greatly appreciated!!!!!!!

Adding Values In A Column
Hi

I have another newbie question. I want to add all the vaules in a column called test1 on worksheet "Data" and give a total on cell A1 on Worksheet "Total". How do i do this.

Thanks


Edit by Moderator:
Please post Excel questions, in the Excel forum.

Thank you.

Adding Up Values That Are Duplicates
This is the current code I have

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Qtr As Range, i As Integer
i = 7
If Target.Address(False, False) = "C7" Then
Range("F7:J34").ClearContents
For Each Qtr In Range("F39:F13500")
If Qtr.Value = Range("C7").Value Then
Range(Cells(i, 6), Cells(i, 10)).Value = _
Range(Cells(Qtr.Row, 6), Cells(Qtr.Row, 10)).Value
i = i + 1
End If
Next Qtr
End If
End Sub

What this does is look through a chart I have and when I select a quarter from the drop down list it shows the hours of training for each employee. Now I was trying to find out if it finds a duplicate last name would it be possible to have it just combine the two by adding them together. For instance if it Gator=2 hours and Gator=4 hours is there a way to just have it find them add them together to form just one line of entry Gator=6 hours? Where would I enter that code at?

Adding Values Problem
Hi,

I'm trying to make a program that will read websites and parse for certain values.

I begin a list of names. For example:
Bob
George
Harvey
Alfonzo

Then I start parsing websites. The first website will read like so:
"Bob has 1"
"George has 3"
"Harvey has 2"
"Alfonzo has 0"

The second website will read like so:
"Bob has 5"
"George has 6"
"Alfonzo has 2"
...and so on...

How would I make a list so it shows the persons name, and the value right next the name increases as soon as I parse the value off the website? The value will be increased multiple times.

I'm sorry if I'm not making sense . If you need clarification, please ask. Thanks!

Adding Time Values
Hi

I have a variable amount of time string values that i would like to add to together. For instance if i had the follwing times

"02:22"
"07:36"
"10:47"

and i add them together i want to get "20:45"

i have have developed a very poor way of implementing this and was just wondering if it could be done with the DateAdd function or by some other means.

Thanks for your time
Shane

Adding Textbox Values
1.- How can I add values inside two textboxes and have the result displayed on another textbox?

If I add textbox1 and textbox2 (34 and 50 values) I get 3450 in my answer textbox instead of 84.


2.- Whenever one of my textboxes (1 or 2) is not enabled (due to checkboxes I applied), I don't want for that value to be added to my result. How can I do that?


Thanx for ur help

Adding Text Box Values
I have been trying for the last hour to figure out how I can add text boxes together, and I would definately appreciate any help.
It will ad fine as long as the number is less then 999 (containing no ","). But as soon as someone enters a number that contains a comma, it "chokes". For instance, I enter 25 in the first two boxes and the running total so far is 50, which is correct. Then I enter 1200 in the next box and the running total is now 51...it adds the 1st digit of the number then when it hits the comma it stops.


so if I enter 25 and then 25 and then 2500, it would come up with 52....it adds the two 25's and then adds the 2 from 2500 and gets 52!!

PLEASE HELP!!
THX

Adding Values In Labels
Pry the dumbest Question today, but I'm having problems adding values in labels. I have Six Labels that will end up with a value. I then have a score Label. I was trying to get the Score Label to add up the values in the other six labels. But I get this. If their is a 2 in the first label and a 3 in the next I get 23
me.uitotalScore.Text = Val(Me.uiCount1.text) + Val(me.uicount2.text)...and so on.
What the heck am i doing wrong?!?!?!

Adding Text Box Values
hi

i have 3 text boxes and i want to add all of their values up and hold it in a variable from a module. then display the result in a labels caption on another form, i cant do it though!! i have this:

iAggregate = Val(txtScore1.Text) + Val(txtScore2.Text) + Val(txtScore3.Text)

then an iAggregate variable as a integer in a module. in the label on the other form i have: lblScore.Caption = iAggregate

has anyone got any ideas?

many thanks

Simon.

Another Adding Values Question
I have an array of text boxes holding number values. I total the values in the array and display the total in another text box. My problem is if all of the arrays arn't filled with a value I get a Type Mismatch error. Here is my code, could someone show me how to fix this problem. Thanks for any help.

Private Sub Command1_Click()

Dim i As Long, lRunningTotal As Long
Dim j As Long, lRunningTotal2 As Long
Dim k As Long, lRunningTotal3 As Long
Dim l As Double, dblRunningTotal4 As Double

For i = 0 To 9
lRunningTotal = lRunningTotal + Caltxt(i).Text
lRunningTotal2 = lRunningTotal2 + Protxt(j).Text
lRunningTotal3 = lRunningTotal3 + Carbtxt(k).Text
dblRunningTotal4 = dblRunningTotal4 + Fattxt(l).Text
Next i

CalTotal.Text = Str$(lRunningTotal)
ProTotal.Text = Str$(lRunningTotal2)
CarbTotal.Text = Str$(lRunningTotal3)
FatTotal.Text = Str$(dblRunningTotal4)

End Sub

Adding Values To A List Box
I am trying to load dynamic values into a list box using VB 5.

Basically I want to populate the list box with values from one column in an Access database table. I have created a query in Access that returns all the values I want from that table, now I just need to stick all those values in the list box.

How can I manipulate the results of the query to put those values in my list box?

Adding Values From Access DB
Hi everyone,
I am having severe difficulties finding the information that I need on adding values from a database! What I am trying to do is:
1. Connect to an MSAccess inventory table, fields of item description and price (done)
2. Select items from some sort of list or dropdown
3. Create a total price of all selected items, prefereably on a separate form
I more or less know how to do sums and what-not, but I have no clue how to pull the value from the database and sum it on a new form; and I think that the longer I search for the answer (i've been looking all over the web and through vb books for about 4 hours now ), the more confused I am getting.

I would appreciate any help!!!!
Thank you!!!!!!!!!!

Adding Up Values In An Array
I have a simple query (for you guys of course). A bit tricky for me.

I have an array of 30 text boxes, with numerical values in each box, labelled as text1(a).text, where a = 1 to 30.
Now i simply want to add up all the 30 text box values, and display the total in another text box, text2.text.

Other than adding all 30 values , what is a shortcut for accomplishing this?
Thanks

Adding Two Double Values
hi everybody,
can any one help me with this double addition problem
....................
Private Sub Command1_Click()
Dim i, j As Double



i = 40
j = -40.01





lblTotalBalance.Caption = Round(i, 2) + Round(j, 2)




End Sub

Function Round(nValue As Double, nDigits As Integer) As Double
Round = Int(nValue * (10 ^ nDigits) + 0.5) / (10 ^ nDigits)
End Function

...
i think with these input it should give -0.01. but it gives somestrange numbers. it tried the same logic in java. but it gave the same output.

Adding Coin Values Together.
I put together a program that lets the user enter how many pennies, nickels, dimes, and quarters they have and when they click the calculate button, it generates how much their change is worth. When I test it, it gives the result as being 0.


Code:
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calButton.Click

'Calculate total
Dim Total As Decimal
Total = Val(lblPennies.Text)
Total = Total + Val(lblNickels.Text) * 5
Total = Total + Val(lblDimes.Text) * 10
Total = Total + Val(lblQuarters.Text) * 25
Total = Total / 100
lblTotal.Text = Total

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub lblPennies_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblPennies.Click

End Sub

Private Sub lblNickels_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblNickels.Click

End Sub

Private Sub lblDimes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblDimes.Click

End Sub

Private Sub lblQuarters_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblQuarters.Click

End Sub

Private Sub txtPennies_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtPennies.TextChanged

End Sub

Private Sub txtNickels_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtNickels.TextChanged

End Sub

Private Sub txtDimes_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtDimes.TextChanged

End Sub

Private Sub txtQuarters_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtQuarters.TextChanged

End Sub

Private Sub txtTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtTotal.Click

End Sub

Private Sub lblTotal_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblTotal.TextChanged

End Sub
End Class


The txtPennies etc... are the text boxes the user enters a whole number into.
The lblPennies etc... are the labels that say Pennies etc...

Adding Time Values???
I have a database field that is defined as a "text" field but is stored as a time field "00:00:29", etc.

What I need to do is be able to accumulate this field value and I'm not sure what functions I need to use to do that.

For ex:

00:00:49
00:12:33
00:04:19
01:02:29

I need to be able to accumulate these values and give me the total time.

Thanks,

Adding Two Values; With A Difference.
Hey

I have 2 labels seperated by an addition sign that both randomly generate numbers from 1 - 500 when a button is clicked. I have a text box next to these that the user inputs the sum of the two values shown. I need help with the code, for checking wether the value typed in the textbox is correct when a button is clicked.

Please need help soon, thanks heeps, below is the code used on the button for the randomly generated labels.

Dim obj As New System.Random()
Label1.Text = obj.Next(1, 500).ToString
Label2.Text = obj.Next(1, 500).ToString

Adding Values From A Datagrid
Hi all,
Quick question. I want to add numberical values from the same column of a datagrid and post the sum into a text box. So basically i just want to get the sum of a particular column. what would be the trick to this?
tibor

Adding Values Of A List Box..
hi ..

this buddy getting small problem with list box..

I hv a listbox which stores some values..(gets values from a table)

when ever the listbox is refreshed ,I have to add (sum) all the values which are there in the listbox and i have to show that value in a text box..

I think u ppl got my prob...is there any simple way to get it..????

plz chk it..

thanx & regards
Anu..

Adding Values In A Loop
I am looking for help in adding values obtained in a loop.

When my VB runs the first time and it gathers info like x = 10, y = 20, etc. then when it runs the second time , it again gathers more values eg x = 15, y = 5, etc. When the macro finishes it only displays the values of the last process that run, eg the x = 15, y = 5, etc, how can I get it so it will add all the x's together (10 + 15), all the y's together (20 + 4), etc ?

many thanks

Adding Of Row Values For Flexgrid
Hi, I need to add the values of 2 rows to get a total value. The flexgrid should show something like this ---->

=======
may::01::
=======
Mar::03::
=======
Total::04
=======

I cant get the total value direct from the database as my "total" may contain blanks which might affect the the "total" shown on the flexgrid. (Blanks due to lack of maintanence by admin )

I was wondering if flexgrid might allow me to add two row of values together to get a total. Can someone advise me on this thanks.

==============================================
VBCodes which Im using to get the row values
==============================================

'Set for AR
'Row1
sql = "SELECT count(*) as AR1 from EmpExit " & _
"Where (XRSN01 = '1' AND " & _
"XDCODE = 'A AR' and " & _
"XLYYYY = " & selectedyear & " - 1 and " & _
"XLMM >= 6) OR (XRSN01 = '1' AND " & _
"XDCODE = 'A AR' and " & _
"XLYYYY = " & selectedyear & " and " & _
"XLMM <= 7)"

rscount.Open sql, cn, adOpenKeyset, adLockOptimistic

MSF1.Row = 1
MSF1.Col = 1
MSF1.Text = rscount.Fields("AR1")

rscount.Close

'Row2
sql = "SELECT count(*) as AR2 from EmpExit " & _
"Where (XRSN02 = '1' AND " & _
"XDCODE = 'A AR' and " & _
"XLYYYY = " & selectedyear & " - 1 and " & _
"XLMM >= 6) OR (XRSN02 = '1' AND " & _
"XDCODE = 'A AR' and " & _
"XLYYYY = " & selectedyear & " and " & _
"XLMM <= 7)"

rscount.Open sql, cn, adOpenKeyset, adLockOptimistic

MSF1.Row = 2
MSF1.Col = 1
MSF1.Text = rscount.Fields("AR2")

rscount.Close

Adding Values Into An Array
hi, in my code i have an array called Scharray
it is defined as Dim Scharray(999)

i am reading data from a recordset and i want to add the data from the recordset. i am using the following code to do this:

i=0

Do While Not objRSMon.EOF 'This will be True when we have run out of records
Scharray(i) = objRSMon.Fields("Name").Value
i = i + 1
objRSMon.MoveNext 'Move to the next record
MsgBox "Data: " & Scharray(i) & ""
Loop

i have the msgbox in there to echo out what is there for testing purposes. This doesnt echo anything out apart from the "Data: " part of the code

is this code the right way about going to add data to the array

thanks guys

Adding And Holding Values
I am trying to pass a value to a function that adds it to an existing value

set the value curMkpSnd
set the value curMkpSndT


VB Code:
Function cfLatH(nValue As String) As Variant    Select Case nValue        Case "LatHMTtl"            curMkpSnd = sngTmpLngth * sngTmpQty * (SQT3x3_16PFt / 12)            cfLatH = FormatCurrency(curMkpSnd, 2, 0, 0, 0)        Case "LatHMkp"            curMkpSndT = (curMkpSnd * sngMtlMkpRt)            cfLatH = FormatCurrency(curMkpSndT, 2, 0, 0, 0)            Call fncAdd(curMkpSndT)    End SelectEnd Function  Public Function fncAdd(curIHRngTtl As Currency) As Currency    curIHRngTtl = curIHRngTtl + curMkpSndEnd Function

I want to pass the value of curMkpSndT to the function fncAdd
I watched the value of curIHRngTtl change and it is not changing correctly

what is wrong?

I also am trying to retrieve what would be the total value of curIHRngTtl after all of the additions.

Issue With Adding Up Values
I have a form with 3 text boxes and when a user enters a value it calles a auto calculate so it adds up after each keystroke.

My issue is in my For Loop I get an error if the first thing entered is a period "."

Here is my code:


Code:
For iCnt = 0 To 2
If LenB(txtInfo2(iCnt).Text) <> 0 Then
dblTtl2 = dblTtl2 + CDbl(txtInfo2(iCnt).Text)
End If
Next iCnt


I tried to see if the LenB(txtInfo2(iCnt).Text) = 1 but for some reason it would return as Length of 2. Why is it returning as 2?

If anyone has any other ways I could handle this I would appreciate the advice.

Thanks in advance.

And Or In Boolean Values Adding
I am trying to get a boolean result from the 2 booleans...

if I add True AND True = true
False And True = false
false and false = false ... etc...

now... how do I do this with code... I tried
?True & True and I get...
TrueTrue

Adding Values Of A List Box
how do you add the values of a listbox?

this number will by dynamic, so if the user inputs 10 numbers, it should add all 10 numbers, if the inputs 4 numbers, it should add 4.

Adding Two 32 Bits Values.
Hi again.

Im trying to add two hex numbers, but I cant get it right...


Code:
Private Sub Command1_Click()
Dim z As String

z = Hex(PADD(&H80000000, &H80000000)) ' z should be "00000000", and works fine.
z = Hex(PADD(&H80000000, &H87654321))' z should be "07654321", and works fine.
z = Hex(PADD(&H12345678, &H87654321))' z should be "99999999", does not work. I get "19999999".
End Sub

Public Function PADD(ByVal x As Long, ByVal y As Long) As Long
PADD = (x And &H7FFFFFFF) + (y And &H7FFFFFFF)
End Function



Any idés?

And is there any good sites out there with some help on this stuff?

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