Math problem vb6 to vb.net
Math problem vb6 to vb.net
Math problem vb6 to vb.net
Math problem vb6 to vb.net
Math problem vb6 to vb.net
Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net
Math problem vb6 to vb.net Math problem vb6 to vb.net
Math problem vb6 to vb.net
Go Back  Xtreme Visual Basic Talk > > > Math problem vb6 to vb.net


Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2016, 09:00 PM
JBSRace1 JBSRace1 is offline
Newcomer
 
Join Date: Sep 2003
Posts: 5
Default Math problem vb6 to vb.net


I have a old vb 6 app that im trying to redo in .net & math that worked in vb6 will not work.
I know this was not the best way to do it back then but it worked.
Here is the old code.


If Text5.Text > Text7.Text Then
Text6.Text = Text7.Text - Text5.Text
Text6 = Text4 - (Text6.Text / 38) * 0.001
Text6.Text = Round(Text6.Text, 3)
End If

& This is what I am trying that wont work in .net

Dim CET As Single
Dim PET As Single
Dim CDA As Single
Dim PDA As Single
Dim DAC As Single

PDA = TextBox5.Text
CDA = Label10.Text
DAC = Label13.Text
CET = TextBox9.Text
PET = TextBox4.Text

If TextBox5.Text > Label10.Text Then
Label13.Text = "-" & (PDA - CDA)
CET = PET - (DAC / 38) * 0.001
CET = Math.Round(CET, 3)
End If

Any advice would be greatly appreciated.

Thanks
Reply With Quote
  #2  
Old 03-15-2016, 03:42 AM
Goggy's Avatar
Goggy Goggy is offline
Contributor
 
Join Date: Sep 2005
Location: Enschede,The Netherlands
Posts: 670
Default

you can't directly put a string value into a single. You will have to convert it first. this can be done by using single.parse or csng for example.
__________________
As finishing touch, god created the Dutch!

utterly useless, but always trying to help
Reply With Quote
  #3  
Old 03-15-2016, 05:52 PM
JBSRace1 JBSRace1 is offline
Newcomer
 
Join Date: Sep 2003
Posts: 5
Default

Thank you sir. I will give it a try
Reply With Quote
  #4  
Old 03-18-2016, 08:08 AM
Roger-U Roger-U is offline
Centurion
 
Join Date: Apr 2008
Location: Surrey, UK
Posts: 111
Default

"If Text5.Text > Text7.Text Then" so 23.5 will be > 123.5 as you are simple comparing strings (even in VB6)

"Text6 = Text4 - (Text6.Text / 38) * 0.001"
in .NET Text6 does not default to text6.text
Reply With Quote
Reply

Tags
dim, single, cet, pet, cda, dac, pda, text6.text, text7.text, text5.text, math, textbox5.text, label10.text, vb6, label13.text, .net, app, textbox4.text, greatly, appreciated, math.roundcet, advice, textbox9.text, code, text6


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Math problem vb6 to vb.net
Math problem vb6 to vb.net
Math problem vb6 to vb.net Math problem vb6 to vb.net
Math problem vb6 to vb.net
Math problem vb6 to vb.net
Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net Math problem vb6 to vb.net
Math problem vb6 to vb.net
Math problem vb6 to vb.net
 
Math problem vb6 to vb.net
Math problem vb6 to vb.net
 
-->