开发者

Vb.net combobox name issue

开发者 https://www.devze.com 2023-03-30 08:40 出处:网络
I want to concat two strings and I need the name of a combo box to be the result of concatenation. F开发者_运维知识库or example,

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消