Using VB 2026.
So I can't be sure this worked in 2022 version, but I thought you could do something like:
This seems to work just fine for Yo and lbName, but... MyVar.cmbChoice throws an error: Value of type 'ComboBox' cannot be converted to 'VisualStyleElement.ComboBox'.Code:Private Class MyClass Public Yo as String Public lbName as Label Public cmbChoice as ComboBox End Class ... (button click, can't be bothered to type it out) Dim myVar as New MyClass myVar.Yo = "Hey there, you beautiful code." myVar.lbName = Label1 myVar.cmbChoice = ComboBox1 ....
Obviously I plan to make an array or list of these as there's going to be lots of them, with multiple controls needing to be assigned to one variable so they can all be altered or read with respect to that item. So I'd like a variable class that just points to the controls instead of trying to make control arrays and accessing them all that way. I think it just makes it clearer what's going on, why they're being recorded that way, and so on. Would this work in VB 2022? If so... I may just go back to it rather than trying to figure out this mess.




Reply With Quote
