i need to format my textbox result into two decimal places after i divide two textbox
here is my code.

If String.IsNullOrEmpty(txtMonthly.Text) OrElse String.IsNullOrEmpty(txtdr.Text) Then Exit Sub
    If Not IsNumeric(txtMonthly.Text) OrElse Not IsNumeric(txtdr.Text) Then Exit Sub
    txtDaily.Text = CDbl(txtMonthly.Text) / CDbl(txtdr.Text)

Thanks in Advance

You are assigning a double to a string.

Should probably be like:
dim num as double

num=CDbl(txtMonthly.Text) / CDbl(txtdr.Text)

You could use

FormatNumber(x, 2)

where x is the value you wabt to format and 2 is the number of decimal places.

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.