Thanks Alot Jim, what if some of the textbox is empty? that is if some or one textbox doesnot contain any value i want to always calculate to get the total of textboxes with value out of all the textboxes.
Then you might consider putting all of the textboxes into a GroupBox and doing the following
Dim sum As Double = 0.0
For Each tbx As TextBox In GroupBox1.Controls.OfType(Of TextBox)()
If tbx.Text <> "" AndAlso IsNumeric(tbx.Text.Substring(1)) Then
sum += CDbl(tbx.Text.Substring(1))
MsgBox("sum is " & sum)
In the validation code for each textbox, make sure the text is well-formed. If it is, store the value in a module-level private Integer value. If not, cancel the validation, forcing the user to enter a valid value. Allow an empty field, which loads the module-level variable with 0. In the end, just add up all the module-level variables and display the result.
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.
OK, so HostGator for some reason no longer allows gcc/g++ access unless you have a Designated Server account, which is a lot of money to spend just to compile my "Hello World" program. Thus I figured I'd compile at home, then upload. Program is your regular old bare-bones Hello World ...