❔ User control form
i have made a user control form with a button in it and now i want this same button to open different form(each different form is a different cinema theatre )
6 Replies
StreamReader read = new StreamReader(@"C:\Users\musht\source\repos\WinFormsApp2\Movies.txt");
int count = int.Parse(read.ReadLine());
for (int i = 0; i < count; i++)
{
var button = (Button)sender;
button.Tag = i;
var identifier = (int)button.Tag;
var form = new BookTime(identifier);
form.ShowDialog();
} i have this code in my book click event count is the number of movies form.ShowDialog(); this here shows 3 different cinema theatre but it opens 3 times when i press book once instead it should assign the 1st theatre to the first book button 2nd to the 2nd book button and so on
} i have this code in my book click event count is the number of movies form.ShowDialog(); this here shows 3 different cinema theatre but it opens 3 times when i press book once instead it should assign the 1st theatre to the first book button 2nd to the 2nd book button and so on
are buttons hard-coded?
or created on login
the button is made on the user control form
this is what it looks like
this user control is in a for loop thats why it shows multiple times with differnt lable
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.