private void ValChngBut_Click(object sender, EventArgs e)
{
if (ValLstBox.SelectedIndex >= 0)
{
int index = ValLstBox.SelectedIndex;
///////add////////
//string newv = ValuetextBox.Text;
string newl = LabeltextBox.Text;
//validations here. 1.No duplicates, 2.v could be numeric only
//Checking duplicate value and lable
if (isDuplicate(newl))
{
MessageBox.Show("Duplicate entry!");
}
else
{
/////remove////////
ValLstBox.Items.RemoveAt(index);
//Adding to list if value is unique
ValLstBox.Items.Insert(index, newl );
//ValuetextBox.Text = "";
LabeltextBox.Text = "";
}
}
}