Reputation: 39
I have a compact framework application [vb.cf] running on windows CE platform. I have a user control that I add multiple times to my to my form , to form a grid, in run-time.
I am now trying to access and set the properties on my user controls and using the ;
Dim mod_prop As ctl_mod_table = CType(Me.pnl_table.Controls("ctr_" & icount), ctl_mod_table)
This produces the following error :
Conversion from string "ctr_1" to type integer is not valid???
Any reason why I get this?
I DO NOT WANT TO USE A LOOP ALL CONTROLS procedure as this is slow.
Upvotes: 1
Views: 270
Reputation: 67178
In the Compact Framework you must search the controls by name manually. This SO question has a CF-specific answer.
Upvotes: 1
Reputation: 14609
your Controls(...)
is using an index value, so an integer. Here you are trying to pass a string variable, ctr_1
, which is obviously... not an integer.
You need to access your control by its name, try simply to call Me.Controls("ctr_" & icount)
instead of Me.pnl_table.Controls("ctr_" & icount)
: you will look at the controls of the form.
Upvotes: 0