Make a function for genrating id
void Id()
{
string query = "select * from POS1 where Warehouse='" + Warehouse.Text + "' order by No";
DataTable dt = conn.fill(query);
string id = ""; int ID = 0;
if (dt.Rows.Count > 0)
{
int ctr = dt.Rows.Count - 1;
id = dt.Rows[ctr]["NO"].ToString();
ID = int.Parse(id);
ID++;
string no =V3W000.ToUpper();
id = no + "/" + ID;
}
else
{
string no = V3W000.ToUpper();
ID = 1;
id = no+ "/" + ID;
}
TextBox.Text = id;
}