473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

why will this program not build or run?

Ron
I've got this simple program that will not build or run, any idea
what I am doing wrong?

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnCalculate.Click
Dim c As Double = CDbl(txtOrderCost.Text)
Dim r As Integer = CInt(txtMonthlyDemand.Text)
Dim p As Double = CDbl(txtPartCost.Text)
Dim f As Double = 0.15
Dim h As Double = p * f
Dim eoq As Double = 0

eoq = (p / r) * 0.15 * 332100

lblEOQ.Text = "EOQ = " & eoq

End Sub

Feb 13 '07 #1
10 1378
A double is expection whole numbers & not 0.15

try using 'Decimal' as the result instead of 'Double'

Example:

Dim eoq As Decimal = (p / r) * 0.15 * 332100
lblEOQ.Text = "EOQ = " & eoq

I haven't tried your code because you never gave any possible values for
OrderCost, MonthlyDemand or PartCost

--
Newbie Coder
(It's just a name)
Feb 13 '07 #2
Well, if it won't compile (build) then it certainly won't run so the fact
that it won't run is irrevalent.

What compile-time error(s) are you getting?
"Ron" <pt*****@yahoo.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
I've got this simple program that will not build or run, any idea
what I am doing wrong?

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnCalculate.Click
Dim c As Double = CDbl(txtOrderCost.Text)
Dim r As Integer = CInt(txtMonthlyDemand.Text)
Dim p As Double = CDbl(txtPartCost.Text)
Dim f As Double = 0.15
Dim h As Double = p * f
Dim eoq As Double = 0

eoq = (p / r) * 0.15 * 332100

lblEOQ.Text = "EOQ = " & eoq

End Sub
Feb 13 '07 #3
Ron
OK here is what I have for the code now and it still will not load my
form when I run it.

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnCalculate.Click
Dim c As Double = CDbl(txtOrderCost.Text)
Dim r As Integer = CInt(txtMonthlyDemand.Text)
Dim p As Double = CDbl(txtPartCost.Text)
Dim f As Decimal = CDec(0.15)
Dim h As Double = p * f
Dim eoq As Decimal = CDec((p / r) * 0.15 * 332100)

'for the eoq, use the below formula as a guide
'replace with correct formula
'eoq = CDec((p / r) * 0.15 * 332100)

lblEOQ.Text = "EOQ = " & eoq

End Sub
FOR THE INPUTS I AM USING :
order cost 25.00
Monthly demand 90000
Part cost 18.75
Thats what I want to use but the form never opens for me to enter them
in, I dont even get that far.

On Feb 12, 8:04 pm, "Newbie Coder" <newbieco...@spammeplease.com>
wrote:
A double is expection whole numbers & not 0.15

try using 'Decimal' as the result instead of 'Double'

Example:

Dim eoq As Decimal = (p / r) * 0.15 * 332100
lblEOQ.Text = "EOQ = " & eoq

I haven't tried your code because you never gave any possible values for
OrderCost, MonthlyDemand or PartCost

--
Newbie Coder
(It's just a name)

Feb 13 '07 #4
Ron
On Feb 12, 8:36 pm, "Ron" <pts4...@yahoo.comwrote:
OK here is what I have for the code now and it still will not load my
form when I run it.

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnCalculate.Click
Dim c As Double = CDbl(txtOrderCost.Text)
Dim r As Integer = CInt(txtMonthlyDemand.Text)
Dim p As Double = CDbl(txtPartCost.Text)
Dim f As Decimal = CDec(0.15)
Dim h As Double = p * f
Dim eoq As Decimal = CDec((p / r) * 0.15 * 332100)

'for the eoq, use the below formula as a guide
'replace with correct formula
'eoq = CDec((p / r) * 0.15 * 332100)

lblEOQ.Text = "EOQ = " & eoq

End Sub
FOR THE INPUTS I AM USING :
order cost 25.00
Monthly demand 90000
Part cost 18.75
Thats what I want to use but the form never opens for me to enter them
in, I dont even get that far.

On Feb 12, 8:04 pm, "Newbie Coder" <newbieco...@spammeplease.com>
wrote:
A double is expection whole numbers & not 0.15
try using 'Decimal' as the result instead of 'Double'
The only error I get says the program has exited with e 0 (0x0)
Example:
Dim eoq As Decimal = (p / r) * 0.15 * 332100
lblEOQ.Text = "EOQ = " & eoq
I haven't tried your code because you never gave any possible values for
OrderCost, MonthlyDemand or PartCost
--
Newbie Coder
(It's just a name)- Hide quoted text -

- Show quoted text -

Feb 13 '07 #5
Hmmm. I just created a new project in VB 2005 and craeted the 3 text boxes
that you listed, the one label, and the calculate button. I did not have
any problems at all running the program. It would take all but 3 minutes,
have you tried creating a completely new project and trying this again?

Tony

"Ron" <pt*****@yahoo.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...
On Feb 12, 8:36 pm, "Ron" <pts4...@yahoo.comwrote:
>OK here is what I have for the code now and it still will not load my
form when I run it.

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnCalculate.Click
Dim c As Double = CDbl(txtOrderCost.Text)
Dim r As Integer = CInt(txtMonthlyDemand.Text)
Dim p As Double = CDbl(txtPartCost.Text)
Dim f As Decimal = CDec(0.15)
Dim h As Double = p * f
Dim eoq As Decimal = CDec((p / r) * 0.15 * 332100)

'for the eoq, use the below formula as a guide
'replace with correct formula
'eoq = CDec((p / r) * 0.15 * 332100)

lblEOQ.Text = "EOQ = " & eoq

End Sub
FOR THE INPUTS I AM USING :
order cost 25.00
Monthly demand 90000
Part cost 18.75
Thats what I want to use but the form never opens for me to enter them
in, I dont even get that far.

On Feb 12, 8:04 pm, "Newbie Coder" <newbieco...@spammeplease.com>
wrote:
A double is expection whole numbers & not 0.15
try using 'Decimal' as the result instead of 'Double'
The only error I get says the program has exited with e 0 (0x0)
Example:
Dim eoq As Decimal = (p / r) * 0.15 * 332100
lblEOQ.Text = "EOQ = " & eoq
I haven't tried your code because you never gave any possible values
for
OrderCost, MonthlyDemand or PartCost
--
Newbie Coder
(It's just a name)- Hide quoted text -

- Show quoted text -

Feb 13 '07 #6
Describing what happens in the first place is always a good idea ;-)

For now it would make me thought that you just show the form. But showing
the form doesn't mean that control is necessarily transfered to the form. In
this case the program just continues and ends...

What is your startup object ? IMO the relevant code is the code that launch
the forms...

"Ron" <pt*****@yahoo.coma écrit dans le message de news:
11*********************@m58g2000cwm.googlegroups.c om...
On Feb 12, 8:36 pm, "Ron" <pts4...@yahoo.comwrote:
>OK here is what I have for the code now and it still will not load my
form when I run it.

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnCalculate.Click
Dim c As Double = CDbl(txtOrderCost.Text)
Dim r As Integer = CInt(txtMonthlyDemand.Text)
Dim p As Double = CDbl(txtPartCost.Text)
Dim f As Decimal = CDec(0.15)
Dim h As Double = p * f
Dim eoq As Decimal = CDec((p / r) * 0.15 * 332100)

'for the eoq, use the below formula as a guide
'replace with correct formula
'eoq = CDec((p / r) * 0.15 * 332100)

lblEOQ.Text = "EOQ = " & eoq

End Sub
FOR THE INPUTS I AM USING :
order cost 25.00
Monthly demand 90000
Part cost 18.75
Thats what I want to use but the form never opens for me to enter them
in, I dont even get that far.

On Feb 12, 8:04 pm, "Newbie Coder" <newbieco...@spammeplease.com>
wrote:
A double is expection whole numbers & not 0.15
try using 'Decimal' as the result instead of 'Double'
The only error I get says the program has exited with e 0 (0x0)
Example:
Dim eoq As Decimal = (p / r) * 0.15 * 332100
lblEOQ.Text = "EOQ = " & eoq
I haven't tried your code because you never gave any possible values
for
OrderCost, MonthlyDemand or PartCost
--
Newbie Coder
(It's just a name)- Hide quoted text -

- Show quoted text -


Feb 13 '07 #7
Ron

I have used the values you have given me & I get the result of: 'EOQ =
103.78125'

Here is the code:

Dim c As Double = 25.00
Dim r As Integer = 9000
Dim p As Double = 18.75
Dim f As Double = 0.15
Dim h As Double = p * f
Dim eoq As Double = CDbl((p / r) * 0.15 * 332100)
TextBox1.Text = "EOQ = " & eoq

The code compiles for me ok with no errors

Maybe you don't need 5 decimal places then it could be formatted simply by:

TextBox1.Text = "EOQ = " & Format(eoq, "#.###")
Result: 'EOQ = 103.781'

This will give you the whole number & then to 3 decimal places:

TextBox1.Text = "EOQ = " & Format(eoq, "#.##")
Result: 'EOQ = 103.78'

The above to 2 decimal places & so on

I hope this helps,

--
Newbie Coder
(It's just a name)
Feb 13 '07 #8
Ron
thanks everyone. I started a new project and redid it and it compiled
fine.

On Feb 13, 11:46 am, "Newbie Coder" <newbieco...@spammeplease.com>
wrote:
Ron

I have used the values you have given me & I get the result of: 'EOQ =
103.78125'

Here is the code:

Dim c As Double = 25.00
Dim r As Integer = 9000
Dim p As Double = 18.75
Dim f As Double = 0.15
Dim h As Double = p * f
Dim eoq As Double = CDbl((p / r) * 0.15 * 332100)
TextBox1.Text = "EOQ = " & eoq

The code compiles for me ok with no errors

Maybe you don't need 5 decimal places then it could be formatted simply by:

TextBox1.Text = "EOQ = " & Format(eoq, "#.###")
Result: 'EOQ = 103.781'

This will give you the whole number & then to 3 decimal places:

TextBox1.Text = "EOQ = " & Format(eoq, "#.##")
Result: 'EOQ = 103.78'

The above to 2 decimal places & so on

I hope this helps,

--
Newbie Coder
(It's just a name)

Feb 13 '07 #9
Glad you had a result, Ron

--
Newbie Coder
(It's just a name)
Feb 13 '07 #10
dotnet is too verbose; your IDE is expecting more verbosity

I would reccomend just adding a whole assload of more code in it and
see if it works then

On Feb 12, 4:52 pm, "Ron" <pts4...@yahoo.comwrote:
I've got this simple program that will not build or run, any idea
what I am doing wrong?

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnCalculate.Click
Dim c As Double = CDbl(txtOrderCost.Text)
Dim r As Integer = CInt(txtMonthlyDemand.Text)
Dim p As Double = CDbl(txtPartCost.Text)
Dim f As Double = 0.15
Dim h As Double = p * f
Dim eoq As Double = 0

eoq = (p / r) * 0.15 * 332100

lblEOQ.Text = "EOQ = " & eoq

End Sub

Feb 14 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
by: dterrors | last post by:
Will php 6 do strong typing and/or namespaces? I was shocked to find out today that there are some people who actually argue that weak typing is somehow better. I didn't even know there was a...
1
by: Adi | last post by:
A java program we have written crashes with IBM JDK 1.3.1 on linux. It works fine on other platforms(Solaris,HPUx). It gets a SIGSERV Signal 11 and crashes just after few minutes after starting up....
11
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >>...
3
by: Mark Rockman | last post by:
------ Build started: Project: USDAver2, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error...
6
by: Dmitry Duginov | last post by:
My web application uses resource files to keep localized strings etc. Those resource files prepared by external console program, which extracts this stuff from the database. Is there a way to...
4
by: KenFehling | last post by:
Hello. I am wondering if there exists a piece of software that takes multiple .js files that are nicely indented and commented and create one big tightly packed .js file. I'm hoping the one file...
5
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all...
4
by: mike | last post by:
I need to do a minor update to a 8051 program written in assembler in 1994 and assembled on a machine/language that no longer exists. I wrote the program, so I have some idea how it works. The...
8
by: Jothishankar | last post by:
Hi, I am new to c#. I am trying to build an application that does backup of files to an external hard disk. My application behaves strangely. When i run the application under debug mode (F5),...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.