User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Can anyone help with this J# problem? Page [1]  
BlackSheep
Suspended
1575 Posts
user info
edit post

I am new to J# and I have been working on a program which contains a dynamically added array of tabs, with each tab being able to have an array of buttons dynamically added by the user. Each of the new tabs added by the user contains a combo box which can then be used to add the buttons.

I need a way to figure out which tab is selected by the user so that I know what panel to add the buttons to. In Java I would just used an ActionListener to pull out the name of the ComboBox that performed the action, but I haven't found a way to do that in J#. Instead I'm attempting to do it the following way:
private void comboBox2_SelectedIndexChanged(Object sender, System.EventArgs e)
{
try {
for (int c = 0; c <= i; c++)
{
if (System.ResolveEventArgs.ReferenceEquals(sender, comboBox2Coffee))
{
timerStartButton[j] = new Button();
this.timerStartButton[j].set_Text(serviceCode[j]);
this.timerStartButton[j].set_Location(new System.Drawing.Point(3, 3));
this.timerStartButton[j].set_Name(timerStartButton[j].get_Text());
this.timerStartButton[j].set_Size(new System.Drawing.Size(384, 30));
this.timerStartButton[j].set_TabIndex(0);
this.timerStartButton[j].set_UseVisualStyleBackColor(true);
this.timerStartButton[j].add_Click(new System.EventHandler(this.projectNameBtn));
this.flowLayoutPanel1Coffee.get_Controls().Add(this.timerStartButton[j]);

}

ResolveEventArgs.ReferenceEquals does not pull out the name of the combo box though. How do i do this?

8/31/2007 2:34:24 PM

Shaggy
All American
17820 Posts
user info
edit post

I'm more of a java guy myself. In java it would be e.getSource()==comboBox2Coffee.

Assuming that the sender in the parameters is the object that fired the event, I'd think a simple sender==comboBox2Coffee would work.

or maybe try sender.ReferenceEquals(comboBox2Coffee).

8/31/2007 3:36:14 PM

 Message Boards » Tech Talk » Can anyone help with this J# problem? Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.