I have a list view with data in it. I wanted to transfer those data into a form called view/edit form. What I did was when a row is clicked it would transfer the data to a set of hidden textbox that would store the data from the list view. My plan is to transfer it to another form.
In my view & edit button, I have already used a constructor to pass a text (1,2 & 3). The use of that text was to determine if the contents of that form will be disabled (1 - viewing, so everything except the close button is disabled, 2 - add, so everything is enabled & 3- edit, some textboxes are enabled and some are not.)
If you're wondering why I went with this, it's because I want to use 1 form only for those 3 functions.
My attempt would be to use another constructor to pass the data from the textboxes of frm1 to frm2. How would I go about passing 2 different constructors?
I have here a slice of the code to give you more info:
Form 1
public string x = "1", y = "2", z = "3";
public void Viewbtn_Click(object sender, EventArgs e)
{
Identifier1.Text = x;
if (Mastercombo.Text == "Suppliers")
{
Supplier viewsupp = new Supplier(Identifier1.Text);
viewsupp.Show();
}
}
Form 2
public Supplier(string identifier)
{
InitializeComponent();
identifierlbl.Text = identifier;
}
private void Supplier_Load(object sender, EventArgs e)
{
if(identifierlbl.Text == "1")
{
SuppID.Enabled = false;
SuppName.Enabled = false;
SuppTIN.Enabled = false;
}
else if(identifierlbl.Text == "3")
{
SuppID.Enabled = false;
}
}