events - Change properties of an unknown object in VB.NET -


I have a sub that handles when the index of 14 combobox changes I am able to insert the sender of the event and there I'm gaining properties from After that, however, I want to be able to change the assets of the real sender instead of the cast. How do I do this?

Current code:

  Private sub combo box index change (as the system. Sender, system, e-mail and system.avantarg) combo box 1 Handles Selected indices, combo box 2. Selected Indexes [etc.] Combo box = Demand for slowcombbox as sender myComboBox.Text Episode "Will" Me Controls (myComboBox.Name). Text = "555-555-555" episode "Bob" Me Control (myComboBox.Name).  

As you can see, I am currently trying to use

  me. Control (myComboBox.Name). Text  

But I get an error: the object reference is not set to an instance of an object.

What can I do?

The sender parameter (typically) event raised in an event handler In the case of the combo box control in the case of the reference of the object selected index styling , it will be the combobox whose selected index > Property was changed. Then your code above myComboBox is discussing the combo box in the sample, which has raised the event.

To clarify: If you select an item in the drop-down, the combo box control list, so that it selected existing exchange Increases the event, the sender parameter of the event handler same combo box , not its copy This is true for all reference types.

If this incident had to be expanded in a way, then it would be a totally different story, but this is a very rare case (this happens when it happens to control a form for).


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -