Dear Sir Please Help Me that,I want to get result after Calculating here wag=4349 not as Wag=4349.25 that means just like Round Function In Excel

wag = (Val(bsc) / Val(DropDownList1.Text)) * Val(TextBox7.Text)
        TextBox9.Text = Val(wag)


esic = (Val(bsc) / Val(DropDownList1.Text)) * Val(TextBox7.Text)
        TextBox9.Text = Val(wag)

and also how is this possible to use Just like Roundup Function in Excel as
esic=71.1 then need to be esic=72

Is it Possible also in Access Query Analyzer ?
If possible Please Help Me

Thanks

Recommended Answers

All 3 Replies

You may want to set a datatype with your val() functions. such as
if you want the decimals:

wag = (Val(bsc) as Double / Val(DropDownList1.Text)as Double)*Val(TextBox7.Text) as Double
TextBox9.Text = (Val(wag) as Double).ToString

this is provided your doing this in VB. If you don't want the decimals just tell it to use integers instead. and make sure the datatypes of all your variables match. If you don't want decimal points, never use a double, unless you plan on casting it to an integer.

Dim a, j, k, wag, hra, ta, oth, bsc, pf, esi As Double

        str = "select *from emp_details where card_no='" & TextBox2.Text & "'"
        cmd = New OleDbCommand(str, cn)
        dr = cmd.ExecuteReader()
        If Not dr.Read = False Then
            
            bsc = dr.GetValue(7)
            a = dr.GetValue(8)
            j = dr.GetValue(9)
            k = dr.GetValue(10)

        End If
        dr.Close()
        wag = val(Val(bsc) as double   / Val(DropDownList1.Text) as double * Val(TextBox7.Text)as double
        TextBox9.Text = Val(wag)
        hra = Val(Val(a) / Val(DropDownList1.Text)) * Val(TextBox7.Text)
        TextBox10.Text = Val(hra)
        ta = Val(j / DropDownList1.Text) * Val(TextBox7.Text)
        TextBox11.Text = ta
        oth = Val(k / DropDownList1.Text) * Val(TextBox7.Text)
        TextBox12.Text = oth
        pf = Val((wag * 12) / 100)
        TextBox13.Text = pf
        esi = Val(((wag + hra + ta + oth) * 1.75) / 100)
        TextBox14.Text = esi
        TextBox15.Text = 5

Dear Sir Error Showing at Highlighted Text as Please Give me solution wag = val(Val(bsc) as double / Val(DropDownList1.Text) as double * Val(TextBox7.Text)as double

I do apologize, it's been a long time since I've worked in VB, I work in C# or Java now, and neither have the Val() function. I might have been mistaken in putting the "as double" in there.
http://msdn.microsoft.com/en-us/library/k7beh1x9(VS.71).aspx
that may help with the issue.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.