Click here to Skip to main content
15,889,176 members

Comments by Beji_ (Top 5 by date)

Beji_ 11-Aug-21 5:04am View    
Thank you, I'm totally stupid. I didn't notice that I have a foreach in the loop for. I played with it last night and when it bore it I said to myself what I was doing to you and I didn't notice this. Thanks for the help and I apologize for the unnecessary question that I would have noticed myself for sure if I had looked at it better that evening. So thanks :)
Beji_ 10-Aug-21 10:21am View    
Nice I trying some stuffand now its doing pretty well. Thanks for help :)
Beji_ 10-Aug-21 9:56am View    
how can I separete for button1 and button2 ? Because I have it 2 buttons. So if I click on button1 I need get Parent.Name; and if on button2 i need only button.Name;
Now I have it on UserControl(btnMini.cs) have for button1 and button2 I add method OnClick for Click Actions.
Copy Code
public event EventHandler ButtonClick;
private void TestingClicks(object sender, EventArgs e)        {            ButtonClick?.Invoke(sender, e);         }        

public void OnClick(object sender, EventArgs e)        {            TestingClicks(sender, e);}
Beji_ 10-Aug-21 9:50am View    
btnM.Click += (s, ev) =>
            {
                Button b = (Button)sender;
                MessageBox.Show(b.Name.ToString());
            };

I try like you show but its worng use like this?
Because I need first generate UserControl btnMini on this image -> IMAGE how I mean[^]
So I after this I wanna generate use it button2. And when i click on generate control (UserControl) I need get from Form1 using event handling Name ot button or parrent.
:/
Beji_ 10-Aug-21 9:14am View    
I know I try using this but how do it for generate usercontrol? I
Using button1 in Form1 I generate UserMini to list of control so my proble is how add this generate click event now.

BtnMini btnM=new btnMini();
btnm.Click += //eventhandler from like you say Button b=sender as Button; how do it ??