Hello
I have a problem when making of entering from one form to another appears to me an error "not enough storage is available to complete this operation" if someone can help me, a programming language in which I work is c #
[OP's answer moved to here]
The device on which work is Motorola MC75 has enough memory over 90MB, and all processes in the TaskManager off
namespace MotorolaSmartphon
{
public partial class Form1 : Form
{
private GPS sl = null;
private Symbol.Barcode.Reader myReader = null;
private Symbol.Barcode.ReaderData myReaderData = null;
public string id_unosa;
public Form1()
{
InitializeComponent();
BarcodFunkcija();
FunkcijaZaUcitavanje();
}
private void menuItem1_Click(object sender, EventArgs e)
{
this.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
FunkcijaZaUcitavanje();
}
public void BarcodFunkcija()
{
myReader = new Symbol.Barcode.Reader();
myReaderData = new Symbol.Barcode.ReaderData(Symbol.Barcode.ReaderDataTypes.Text, 7905);
myReader.Actions.Enable();
myReader.ReadNotify += new EventHandler(myReader_ReadNotify);
myReader.Actions.Read(myReaderData);
}
void myReader_ReadNotify(object sender, EventArgs e)
{
Symbol.Barcode.ReaderData nextReaderData = myReader.GetNextReaderData();
this.textBox1.Text = nextReaderData.Text;
myReader.Actions.Read(myReaderData);
SqlCeConnection connn = null;
connn = new SqlCeConnection(@"Data Source=" + GetExePath() + "\\MC75.sdf");
try
{
connn.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
SqlCeCommand cmd = connn.CreateCommand();
try
{
cmd.CommandText = ("INSERT INTO Unos(Barcod) values" + "(" + nextReaderData.Text + ")");
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
}
dataGrid1.DataSource = FunkcijaZaUcitavanje();
connn.Close();
}
static DataTable FunkcijaZaUcitavanje()
{
string SqlCeConnection = (@"Data Source=" + GetExePath() + "\\MC75.sdf");
SqlCeConnection sqlConnection = new SqlCeConnection(SqlCeConnection);
sqlConnection.Open();
SqlCeDataAdapter sqlCommand = new SqlCeDataAdapter("select * from unos", sqlConnection);
DataTable tabelazagrid = new DataTable();
sqlCommand.Fill(tabelazagrid);
return tabelazagrid;
}
static string GetExePath()
{
return (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase));
}
private void Form1_Closing(object sender, CancelEventArgs e)
{
myReader.Actions.Flush();
myReader.Actions.Disable();
myReaderData.Dispose();
myReader.Dispose();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
myReader.Dispose();
}
catch (Exception exx)
{
}
string p;
p = takePicture();
}
private string takePicture()
{
string result = null;
CameraCaptureDialog cameraDialog = new CameraCaptureDialog();
cameraDialog.Mode = CameraCaptureMode.Still;
cameraDialog.StillQuality = CameraCaptureStillQuality.High;
cameraDialog.Resolution = new Size(640, 480);
if (cameraDialog.ShowDialog() == DialogResult.OK)
{
result = cameraDialog.FileName;
}
this.Show();
cameraDialog.Dispose();
return result;
}
private void button3_Click(object sender, EventArgs e)
{
BarcodFunkcija();
}
private void DeleteDataMenuItem_Click_Click(object sender, EventArgs e)
{
SqlCeConnection connn = null;
DialogResult result3 = MessageBox.Show("Brisanje izabranog reda?", "The Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
if (result3 == DialogResult.Yes)
{
connn = new SqlCeConnection(@"Data Source=" + GetExePath() + "\\MC75.sdf");
try
{
SqlCeCommand SL = new SqlCeCommand(" DELETE FROM Unos where ID = " + Convert.ToInt32(id_unosa), connn);
connn.Open();
SL.ExecuteScalar();
connn.Close();
}
catch (SqlCeException ex)
{
MessageBox.Show(ex.Message.ToString());
}
finally
{
FunkcijaZaUcitavanje();
connn.Close();
}
}
}
private void dataGrid1_Click(object sender, EventArgs e)
{
id_unosa = dataGrid1[dataGrid1.CurrentCell.RowNumber, dataGrid1.CurrentCell.ColumnNumber].ToString();
}
private void button2_Click_1(object sender, EventArgs e)
{
GPS GPS = new GPS();
GPS.Show();
}
}
}