How can i call the current button being used?
Got this wall of code being repeated for 30 odd buttons. If i can cut out the butPos7 bit and somehow make it (button that triggered this event) then i can make this all one function. Please help...
And i forgot the picture
>>243724
Goddamnit, actually check back and read the threads you create.
I told you how to do this last time.
>>243727
but cant as i cant get the current button. Tried button.fromHandles etc etc but doesnt work
>>243729
Nevertheless, I answered your question a day before you asked it.
>>243730
You need to use a "control array".
The way you do this is different depending on which version of VB you're using.
>>243736
You're a genius. Remind me prof. Please
>>243737
is there any way to do it the way i want to. Somehow calling the current events trigger button?
>>243724
>>243739
Simplest way to do this is write one function that uses the "Handles" keyword (http://stackoverflow.com/a/5307257), and store the integer you're looking for in each button's "Tag" property.
Tag is a property that's not used by VB, and is provided to let you store small bits of additional information in objects. You can change the contents of any object's tag in the form editor.
So you'd use something like
sub mybutton_click(byval sender as System.Object ...blahblahblah...) Handles Button1.click, Button2.click, Button3.click...Button40.click
Dim myButton as Button = CType (sender, Button)
Magicnumber = CInt(myButton.Tag)
...blahblahblah...
myButton.backcolor=whatever
and so on.
>>243724
I'm more confused on why people In their freetime decide to learn VB, its a terrible depreciated language on the same level as delphi.
>>243764
>What I wondered was, what happens if you take top-notch C++ programmers who dream in pointers, and let them code in VB. What I discovered at Fog Creek was that they become super-efficient coding machines. The code looks pretty good, it’s object-oriented and robust, but you don’t waste time using tools that are at a level lower than you need. I’ve spent years writing code for C++/MFC and years writing code in Visual Basic, and let me tell you, VB is just much, much more productive.
https://www.joelonsoftware.com/2001/10/17/working-on-citydesk-part-three/
>>243772
>2001
Considering C++ has developed immensely (and accompanying libraries) over the past 15 years most of that blog arguments are hold 0 wieght these days.
VB was superseded with C# anyway.
>>243780
When you write something like Stack Overflow, I'll listen to you instead of Joel Spolsky.