Dim agre1, agre2, agre3 As Double
agre1 = Form1.TextBox11.Text
agre2 = Me.TextBox11.Text
agre3 = ((agre1 + agre2) / 2)
TextBox12.Text = agre3
killer88
0
Light Poster
Recommended Answers
Jump to PostWhat is the difference between CDbl() and Convert.ToDouble().
CDbl() is a little smarter by default in that it takes different numbering styles into consideration. You can get a similar effect with Double.Parse() and a formatter of NumberStyles.Any, with the understanding that the extra work has a runtime cost …
Jump to PostImplicit conversion are generally not a good idea. Even though
Option Strict
might be off it's generally a good idea to code like it is on, or to turn it on, and make all your conversion explicit(i.e.TextBox12.Text = agre3.ToString
). It can save some confusion down the road.
All 6 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
tinstaafl
1,176
Posting Maven
Reverend Jim
4,678
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Dili1234
-2
Junior Poster
tinstaafl
1,176
Posting Maven
TnTinMN
commented:
Agreed with completely
+6
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.