passed data being corrupted

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

When I pass a float value '10f' to the following:



public void getForm( float item_NO_ )

{

Console.WriteLine( item_NO_ );

}



I get item_NO_ == 2.382193E-37;



This happens at the very fist of my program.



Am I corruping the heap some how?



What is going on?



Thanks,



Jerry
 
Jerry,

It prints out "10" for me. Can you show a more complete example which
reproduces the results consistently?
 
When I pass a float value '10f' to the following:

public void getForm( float item_NO_ )
{
Console.WriteLine( item_NO_ );
}

I get item_NO_ == 2.382193E-37;

This happens at the very fist of my program.

Am I corruping the heap some how?

What is going on?

We can't tell without reproducing it.
Please post a short but complete program that demonstrates the problem
- see http://pobox.com/~skeet/csharp/complete.html for what I mean by
that.

Jon
 
using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace Procs

{

public partial class Procs : Form

{

public Procs()

{

InitializeComponent();

eMail theMail = new eMail();

// theMail.sendIt( 2, "Tesing New VF SQL error Mangement", "This is a ONLY A
TEST", "" );

}

private void btnCheckSQL_Click( object sender, EventArgs e )

{

// System.NullReferenceException.Equals();

DataVars.PCS a = new DataVars.PCS();

ProcsPCS PCS = new ProcsPCS();

// PCS.start();

// a = PCS.clearForm( a );

//a = PCS.getForm( 0.00f );

//a = PCS.getForm( 0.01f );

a = PCS.getForm( 10f );

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

//a = PCS.nextForm( ( int ) a.recordNO );

//a = PCS.getForm( 10f );

//PCS.saveForm( a );

//PCS.calcA( a, 'I', true, 0, true );

// a = PCS.getForm( 10f );



//PCS.calcK( a, 0 );

//PCS.calcAA( a, 0, 0 );

//PCS.calcAA( a, 1, 10 );

//PCS.calcBB( a, 0, 0 );

//PCS.calcBB( a, 1, 10 );

//PCS.Procedure1();

//PCS.Procedure2();

//PCS.Procedure3();

//PCS.Procedure4( a );

//PCS.Procedure5( a ); // requires SubPCS data to exist!!! is there sich a
thing??

//PCS.collectingData(); // requires SubPCS data to exist!!! is there sich a
thing??

//PCS.collectingPasqtr( a, 1 );

//PCS.collectingData(); // requires SubPCS data to exist!!! is there sich a
thing??

PCS.collectPurchasesData( a, 1 );

PCS.stop();

this.lblDone.Text = "DONE!!";

Application.DoEvents();

}

private void btnExit_Click( object sender, EventArgs e )

{

this.Close();

}

}

}

============

using System;

using System.Collections;

using System.Collections.Generic;

using System.Text.RegularExpressions;

using System.Text;

using System.Data.Sql;

using System.Data.SqlClient;

using System.Data.SqlTypes;

using System.Data;

namespace Procs

{

class ProcsPCS

{

public int lastLine = 0; // the total number of column records / lines /
rows

public int lastForm = 0; // record number of the last form / record in the
table

public DataVars.PCS getForm( float item_NO_ )

{

Console.WriteLine( item_NO_ );

}

}

The code is getting massive. All worked fine yesterday until my system
locked up running this program. After bebooting my system, the bad data
issue started.. I went into the project for this program and deleted all the
exe files and support files. Still the same bad data being passed.

In the c/c++ days it looks like something is getting stepped on!!

Thanks,

Jerry

Nicholas Paldino said:
Jerry,

It prints out "10" for me. Can you show a more complete example which
reproduces the results consistently?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Jerry said:
When I pass a float value '10f' to the following:



public void getForm( float item_NO_ )

{

Console.WriteLine( item_NO_ );

}



I get item_NO_ == 2.382193E-37;



This happens at the very fist of my program.



Am I corruping the heap some how?



What is going on?



Thanks,



Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top