עדיף לראות ברזולוציה גבוהה HD
אימות נתונים בטופס
private bool ValidateName()
{
bool bStatus = true;
if (FirstName.Text == "")
{
errorProvider1.SetError(FirstName, "שדה חובה");
bStatus = false;
}
else
errorProvider1.SetError(FirstName, "");
return bStatus;
}
private void price_KeyPress(object sender, KeyPressEventArgs e)
{
//string allowedCharacterSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.\b\n";
string allowedCharacterSet = "1234567890.\b";
if (allowedCharacterSet.Contains(e.KeyChar.ToString()))
{
if (e.KeyChar.ToString() == "."
&& price.Text.Contains("."))
{
e.Handled = true;
}
}
else
{
e.Handled = true;
}
}
בחירה מתוך רשימה
combobox
using System.IO;
using System.Drawing.Printing;
private void button1_Click(object sender, EventArgs e)
{
printPreviewDialog1.ShowDialog();
}
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
Graphics g = e.Graphics;
g.PageUnit = GraphicsUnit.Millimeter;
String message = "דוח כמות לקוחות";
Font messageFont = new Font("Arial", 14, System.Drawing.GraphicsUnit.Point);
g.DrawString(message, messageFont, Brushes.Black, 90, 15);
var tmp = (from s in db.Customers select s).ToList();
message = "מס הלקוחות הוא :" + Convert.ToString(tmp.Count);
messageFont = new Font("Arial", 12, System.Drawing.GraphicsUnit.Point);
g.DrawString(message, messageFont, Brushes.Black, 90, 25);
int row = 30;
int count = 0;
foreach (Customer x in tmp)
{
count++;
message = Convert.ToString(count)+" "+ x.NickName + " " + x.CellPhone;
g.DrawString(message, messageFont, Brushes.Black, 90, row);
row += 10;
if (count == 10)
break;
}
}