private bool getVendorCode()//method to cheek manufacture code and generate code
{
string vendorName = txtNameVandor.Text.Replace("'", "").Replace("~", "").Replace("`", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace("$", "").Replace("%", "").Replace("^", "").Replace("&", "").Replace("*", "").Replace(" ", "");
vendorName = vendorName .Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "").Replace("+", "").Replace("=", "").Replace("|", "").Replace("\\", "").Replace("{", "").Replace("}", "").Replace("[", "").Replace("]", "").Replace(":", "").Replace("\"", "").Replace(";", "").Replace("'", "").Replace("<", "").Replace(",", "").Replace(">", "").Replace(".", "").Replace("?", "").Replace("/", "");
if (vendorName .Length < tempmanucode = "" vendorname =" vendorName" strsqlquery = "select count(vendor_code) from vendors where vendor_code like '" i =" (Int32)objAccessingBusinessLayer.executeScaler(objAllVariables.strSqlQuery);"> 0)
{
i = i + 1;
tempManuCode = "000" + i;
}
else
{
tempManuCode = "001";
}
vendorName = vendorName + tempManuCode.Substring(tempManuCode.Length - 3);
//objAllVariables.strVenodrCode = vendorName ;
}
catch (Exception er)
{
objCommonMethods.ShowMessageBox(er.Message, objComNam.Caption_Warning, objComNam.Type_Warning);
}
}
if (vendorName .Length < 6)
{
objCommonMethods.ShowMessageBox("Error: Unable To Generate Vendor Code", objComNam.Caption_Warning, objComNam.Type_Warning);
return false;
}
objAllVariables.strVenodorCode = vendorName ;
return true;
}
I love dot net ...this one of very great platform for software developer, which give comprehensive tools and other thing to develop good software . During coding we lack in some way ,here we can help each other to shout out some problem and also we can share some ideas too
Tuesday, November 18, 2008
search in treeView
private void findIntree(TreeNodeCollection tNodeCollection, string p)
{
foreach (TreeNode tNode in tNodeCollection)
{
if (tNode.Name == p)
{
tNode.TreeView.SelectedNode = tNode;
//tNode.= Color.SteelBlue;
tNode.TreeView.SelectedNode.Expand();
break;
}
//else
//{
// tNode.ForeColor = Color.Black;
// //tNode.TreeView.SelectedNode.Collapse();
//}
findIntree(tNode.Nodes, p);
}
}
{
foreach (TreeNode tNode in tNodeCollection)
{
if (tNode.Name == p)
{
tNode.TreeView.SelectedNode = tNode;
//tNode.= Color.SteelBlue;
tNode.TreeView.SelectedNode.Expand();
break;
}
//else
//{
// tNode.ForeColor = Color.Black;
// //tNode.TreeView.SelectedNode.Collapse();
//}
findIntree(tNode.Nodes, p);
}
}
Wednesday, November 5, 2008
implement cheakbox in datagrid view of windows formc
code for Add in data from one grid to another grid on basis of selected cheakbox
private void addL5()//Add on select cheakbox;
{
int j = dgvMyL5.Rows.Count;
foreach (DataGridViewRow drow in dgvAllL5.Rows)
{
if (drow.Cells["select1"].Value != null)
{
if (Boolean.Parse(drow.Cells["select1"].Value.ToString()) == true)
{
if (j == 0)
{
dgvMyL5.Rows.Add();
dgvMyL5["serialNo2", j].Value = j + 1;
dgvMyL5["myComponentsFixedID", j].Value = drow.Cells["ComponentsFixedID"].Value;
dgvMyL5["componentsName", j].Value = drow.Cells["L5ComponentsName"].Value;
dgvMyL5["factoryPrice", j].Value = 0;
j += 1;
}
else
{
int flag = 0;
foreach (DataGridViewRow drow2 in dgvMyL5.Rows)
{
if (drow.Cells["ComponentsFixedID"].Value.ToString() == drow2.Cells["myComponentsFixedID"].Value.ToString())
{
flag = 1;
break;
}
else
{
flag = 0;
}
}
if (flag == 0)
{
dgvMyL5.Rows.Add();
dgvMyL5["serialNo2", j].Value = j + 1;
dgvMyL5["myComponentsFixedID", j].Value = drow.Cells["ComponentsFixedID"].Value;
dgvMyL5["componentsName", j].Value = drow.Cells["L5ComponentsName"].Value;
dgvMyL5["factoryPrice", j].Value = 0;
j += 1;
}
}
}
}
}
}
code for Remove data from one grid to another grid on basis of selected cheakbox
private void removeL4()
{
int length = dgvMyL5.Rows.Count;
for (int i = length - 1; i > -1; i--)
{
if (dgvMyL5.Rows[i].Cells["select2"].Value != null)
{
if (Boolean.Parse(dgvMyL5.Rows[i].Cells["select2"].Value.ToString()) == true)
{
dgvMyL5.Rows.RemoveAt(i);
}
}
}
}
private void addL5()//Add on select cheakbox;
{
int j = dgvMyL5.Rows.Count;
foreach (DataGridViewRow drow in dgvAllL5.Rows)
{
if (drow.Cells["select1"].Value != null)
{
if (Boolean.Parse(drow.Cells["select1"].Value.ToString()) == true)
{
if (j == 0)
{
dgvMyL5.Rows.Add();
dgvMyL5["serialNo2", j].Value = j + 1;
dgvMyL5["myComponentsFixedID", j].Value = drow.Cells["ComponentsFixedID"].Value;
dgvMyL5["componentsName", j].Value = drow.Cells["L5ComponentsName"].Value;
dgvMyL5["factoryPrice", j].Value = 0;
j += 1;
}
else
{
int flag = 0;
foreach (DataGridViewRow drow2 in dgvMyL5.Rows)
{
if (drow.Cells["ComponentsFixedID"].Value.ToString() == drow2.Cells["myComponentsFixedID"].Value.ToString())
{
flag = 1;
break;
}
else
{
flag = 0;
}
}
if (flag == 0)
{
dgvMyL5.Rows.Add();
dgvMyL5["serialNo2", j].Value = j + 1;
dgvMyL5["myComponentsFixedID", j].Value = drow.Cells["ComponentsFixedID"].Value;
dgvMyL5["componentsName", j].Value = drow.Cells["L5ComponentsName"].Value;
dgvMyL5["factoryPrice", j].Value = 0;
j += 1;
}
}
}
}
}
}
code for Remove data from one grid to another grid on basis of selected cheakbox
private void removeL4()
{
int length = dgvMyL5.Rows.Count;
for (int i = length - 1; i > -1; i--)
{
if (dgvMyL5.Rows[i].Cells["select2"].Value != null)
{
if (Boolean.Parse(dgvMyL5.Rows[i].Cells["select2"].Value.ToString()) == true)
{
dgvMyL5.Rows.RemoveAt(i);
}
}
}
}
Subscribe to:
Posts (Atom)