Hi, if somebody can help me..
On main form, I have this set of alphabet letters and a datagridview. Each letter represents the first letter of each item in the datagrid. When a letter has items in the datagrid, it's underlined to show that it's clickable; no items=not clickable. When I click Edit to a row in the datagrid, another form comes up, and after I save the form, it should update the set of alphabet. So, if an item starts with letter A,A shows as clickable. But if I change it to B and save,letter B should now show as clickable, and A not.
Here are the relevant code snippets:
//on main form
public partial class FormMain : Form
{
Label[] lblalpha = null;
public FormMain()
{
InitializeComponent();
lblalpha = new Label[26];
}
public FormMain(Label[] emplalpha,TabPage empltabpage)
{
InitializeComponent();
lblalpha = emplalpha;
tabPage2 = empltabpage;
}
//function to create the alphabet
public void createAlphabet()
{
int x = 150;
int y = 51;
lblalpha = new Label[26];
string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char[] array = alphabet.ToCharArray();
for (int i = 0; i < array.Length; i++)
{
char letter = array[i];
lblalpha[i] = new Label();
lblalpha[i].Text = letter.ToString();
lblalpha[i].Location = new Point(x, y);
lblalpha[i].Size = new Size(15, 13);
Class1.readrecord("Select * from dbo.displayemplbylastname('" + lblalpha[i].Text + "')");
if (Class1.dr.HasRows)
{
lblalpha[i].ForeColor = Color.Blue;
lblalpha[i].Cursor = Cursors.Hand;
lblalpha[i].Font = new Font(lblalpha[i].Font, FontStyle.Underline);
}
Class1.con.Close();
tabPage2.Controls.Add(lblalpha[i]);
lblalpha[i].Click += new System.EventHandler(lblalpha_Click);
x += 25;
}
}
//function to clear the alphabet
public …