private DataTable ShowProduct()
string mach = "select ID,Name from product";
cmd = new SqlCommand(mach,con);
adt = new SqlDataAdapter(cmd);
ds = new DataSet();
Second build funtion create id auto
private int AutoID() //funtion create auto id
DataTable dt = new DataTable();
dt=ShowProduct(); //datatable store list id
int row = -1;
int i = 0;
if (dt.Rows.Count > 0) //at least one id
int id = new int[dt.Rows.Count];
foreach (DataRow mach in dt.Rows) //assigned id in string array
mach1 = dt.Rows[row].ToString();
id[ma] = Convert.ToInt32(mach1.Substring(2)); //get string index=2 to end converter int assigned id in string array
for (int j = 0; j < id.Length; j++) //create auto id
if (id != 1) //first id !=1 set id =0
i = i - 1;
if (id[j] > i) //id[j] != id[j-1]+1 set id=id[j-1]
i = id[j - 1];
return i + 1; //return id need create
private void bttInsert_Click(object sender, EventArgs e)
int id = AutoID(); ////Using
string idpro = "SP" + id.ToString().PadLeft(4, '0');
txtID.Text = idpro;
if (bttInsert.Text == "Insert")
bttInsert.Text = "Save";
if (txtName.Text != "")
dgvShowSP.DataSource = ShowProduct();
bttInsert.Text = "Insert";
MessageBox.Show("Bạn chưa nhập tên sản phẩm");
Theres lots of info about adding buttons to title bar, like this: http://www.codeproject.com/KB/cs/mintraybtn.aspx
But ive seen a couple programs that can add a button like that to every windows window. Like an nvidia(IIRC) app which added a button next to the minimize on EVERY window. Now i need to be able to that, plus assign some code to the button.
Strive to be humble enough to take advice, and confident enough to do something about it.
I need to create characters of the people as requirement of my application, I'm thinking of making cartoons from real life images, I see this done in some facebook application, how should I do this, I have done grayscale and that does not produce the result I need.
Any advice ?
Also tried box blur filter, but effect is not as desired
Those sort of filters tend to be complex, they are certainly not a filter you can create by changing values in a convolution filter. You need to understand the theory behind it and write dedicated code to the effect you're trying to create.
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
A correctly implemented DateTime class should require subtracting 25 hours on the switchover date or 23 depending on the Calender. Which is why one should subtract days and not hours.
I wish I had a dollar for every time I've been through this argument. The clocks on computers use UTC (Universal Co-ordinated Time) based on what was Greenwich Mean Time, but is now agreed by one of the UN bodies. For argument's sake it is as near to GMT as makes no difference. When you want to display the time then the library routines make an adjustment based on the local timezone and the rules for daylight saving time appropriate to that timezone. However all DateTime calculations are based on UTC so there are never any discrepancies such as you imagine; every day is 24 hours long, whatever the time of year. Only in this way can date and time calculations work correctly.
My original comment was in jest suggesting that a good programmer would subtract a day instead of 24 hours; hoping that the parody would drive the point home. My reply to you was to point out that it is entirely possible to come across a 23 or 25 hour day in an implementation. Of course, your reply will once again ignore the point I was trying to make so I don't know why I bother.