Vb.net combobox name issue
I want to concat two strings and I need the name of a combo box to be the result of concatenation. F开发者_运维知识库or example,
parametre = hi
parametre2 = everyone
I have put name hieveryone my combobox name
parametre3 = String.Concat(parametre,parametre2)
dim parametre3 as ComboBox
How can I do solve this problem?
You can't do this. Variable naming occurs at compile time, whereas the string concatenation occurs at execution time.
Generally, if you want to dynamically map strings to values, you should use a Dictionary(Of String, Of ComboBox)
or whatever. Then you can put values into the dictionary by string key, and retrieve them later.
Dim parameter1 As New String("Hi");
Dim parameter2 As New String("everyone");
Dim combo As New ComboBox();
combo.Name = String.Concat(parameter1, parameter2);
精彩评论