A-12 Programmer’s Manual
//***********************************************************
//* btnEnter_Click Event
//* Description:
//* If length of data is 12 print label if not
//* display error message
//***********************************************************
private void btnEnter_Click(object sender,
System.EventArgs e)
{
string fmtUPCA = "{F,1,A,R,E,200,200,\"UPCA\"|"+
"C,150,49,0,50,8,8,A,L,0,0,\"Demo C Sharp\",1|" +
"B,1,12,F,25,28,1,4,100,7,L,0|}";
if (txtUPC.Text.Length != 12)
// Make sure Length is 12
{
MessageBox.Show("Invalid Length", "Entry error",
MessageBoxButtons.OK,
MessageBoxIcon.Hand,
MessageBoxDefaultButton.Button1);
txtUPC.Text = ""; // Reset content to nothing
txtUPC.Focus(); // Focus on the text box
}
else
{
Ultra.Print rPrint = new Print();
// Instantiate Print class
rPrint.ClearError(); // Clear any errors
if (!rPrint.IsBatteryOKToPrint) // Check Battery
MessageBox.Show("Low Battery", "Battery Check");
//--Print Format and then Batch Data
rPrint.Text = fmtUPCA;
rPrint.Text = "{B,1,N,1|E,0,0,1,1,0,1|1,\"" +
txtUPC.Text + "\"|}";
// --Clear UPC and Set Focus
txtUPC.Text = ""; // Reset content to nothing
txtUPC.Focus(); // Focus on the text box
}
}