How to pass a parameter from one class to another

  • Thread starter Thread starter Kokoda144
  • Start date Start date
K

Kokoda144

Guest
I want to get a value (1 or 0) from windows from when a button in pressed back into main but it comes up with an error when run saying "parameter is not valid". I am not sure what I am doing wrong apart from the obvious that there is something wrong with how I am implementing the parameter.


using System;
using System.Windows.Forms;

//Imaging
using System.Drawing.Imaging;
using System.Drawing;

namespace DataCollection
{
public partial class SortpBoundaryImages : Form
{
public int tempFlag = 0;

public int TmpFlag
{
get
{
return tempFlag;
}
set
{
tempFlag = value;
}
}


public SortpBoundaryImages()
{
InitializeComponent();
//Load up the image into the form
Bitmap bmp = new Bitmap(@"C:\ELEC Project\temp.bmp");
pictureBox1.Image = bmp;
bmp.Dispose();
}

//public class ResultFromFrmMain
//{
// public DialogResult Result { get; set; }
// public int Getvalue { get; set; }
//}

private void button1_Click(object sender, EventArgs e)
{
//If the users classifies the image as an impotant point then store it in the PboundaryIntrest folder
int fileNum = Data.ImageCount.ImageSum("PboundaryIntrest");

Bitmap bmp = new Bitmap(@"C:\ELEC Project\temp.bmp");

bmp.Save(@"C:\ELEC Project\PboundaryIntrest\"+ fileNum +".bmp");

bmp.Dispose();

Close();
}

private void pictureBox1_Click(object sender, EventArgs e)
{

}

private void pointOther_Click(object sender, EventArgs e)
{
//If the user classifies the point as not important then store it as a normal P boundary
var tFalg = new SortpBoundaryImages();
tFalg.tempFlag = 1;

Close();
}
}
class DataCollection

{
public static void main()
{
//add in temp image taker
var Psort = new SortpBoundaryImages();
Psort.Show();
var Tflag = Psort.tempFlag;
string gt = "\nboolvaluer is " + Tflag;
Application.ShowAlertDialog(gt);
}
}
}

Continue reading...
 
Back
Top