C#
C#

help

Root Question Message

Basim
Basim12/28/2022
❔ 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 )
Basim
Basim12/28/2022
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
Basim
Basim12/28/2022
count is the number of movies
Basim
Basim12/28/2022
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
MasterSubarashii
MasterSubarashii12/29/2022
are buttons hard-coded?
MasterSubarashii
MasterSubarashii12/29/2022
or created on login
Basim
Basim12/29/2022
the button is made on the user control form
Basim
Basim12/29/2022
Basim
Basim12/29/2022
this is what it looks like
Basim
Basim12/29/2022
this user control is in a for loop thats why it shows multiple times with differnt lable
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy