General Naming(reaching) buttons
Hello everybody!
I am so angry with... I spent one night and whole day to get out of this stuck.
I have problem with naming my button. For example:I have my own XPbutton(UserControl). I want to put the code in core of this control, because on form I have always 2 buttons. button1 name "btn(0)" and button2 named "btn(1)". So it is a control array(name is "btn" and indexes are 0 and 1. I want that whenever after the button1 "btn(0)" is presseed, the button2 "btn(1)" will change the caption. I solve the problem with For Each....IfTypeOf...etc, but I don't wanna use this solution, because if I use that solution, sth else go wrong. So I want just strictly change the caption of button.
If I use Screen.ActiveForm.btn(1).Caption = "yes" - this works. But this are my navigation btns, so I want to use them many times. So I did :
dim bName as string: bName = ScreenActiveControl.Name
dim bInd as Byte: bInd=Screen.ActiveControl.Index. So far so good.
Now I just want to locate:
Screen.Activeform.Contorls(bName(bInd+1)).Caption = "Caption for Second Button" -- Of course this doesn't work, but how can I solve this. Once again, I dont want to use For Each sentence.
Please any suggestion?
Greetings from Slovenia.
Thanks
|