Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling one event procedure from another - HOW-TO? 1

Status
Not open for further replies.

IlyaRabyy

Programmer
Nov 9, 2010
568
US
Colleagues,
In other IV-level languages (at least B4 .NET), I could do something like this (quasi-code, of course)

Code:
PROC cboNumOfItems.SelectedIndexChanged()
IF cboNumOfItems.Selected Index > 0
   chkAllInOne.Enabled = True
ELSE
   chkAllInOne.Enabled = False
ENDIF
ENDPROC

PROC cboNumOfItems.KeyPress(KeyCode)
IF KeyCode = 13
   cboNumOfItems.SelectedIndexChanged() ' Calling another event procedure
ENDIF
ENDPROC

As it happens, such a need arose in my project (VS 2019, VB .NET). I tried to figure out how to do this call - and failed.
And this article in Help, doesn't help me.

Could anyone here "translate" this above code into this modern VB .NET, please?
TIA!


Regards,

Ilya
 
Thank you, Andy, but unfortunately ComboBox has no PerformElectedInedxChanged() method, only the one on the screenshot, PerformLayout.

2022_09_28_14_48_TheOnlyCboPerformMethod_j00ng1.jpg


And even that latter can't be found in the MS documentation:
2022_09_28_15_01_ComboBox_Class_ekwx7b.jpg


Any other suggestions, colleagues, would be greatly appreciated!

Regards,

Ilya
 
Another way would be:

Code:
PROC cboNumOfItems.SelectedIndexChanged()
    [blue]Call JustDoIt()[/blue]
ENDPROC

PROC cboNumOfItems.KeyPress(KeyCode)
IF KeyCode = 13
   [blue]Call JustDoIt()[/blue] [green]' Calling another event procedure[/green]
ENDIF
ENDPROC 

PROC [blue]JustDoIt()[/blue]
IF cboNumOfItems.Selected Index > 0
   chkAllInOne.Enabled = True
ELSE
   chkAllInOne.Enabled = False
ENDIF
END PROC

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Got it!
Thank you!

(I wonder why I didn't think it up myself... gettin' older, I guess! :-( )

Regards,

Ilya
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top