if statement - C# int.TryParse Maybe? -


so error i've been trying figure out can not seem fix. . in 1 function.

file.copy(item.filename, mcad [versiontext.tag], true);  private void version_2_0_click(object sender, eventargs e) {     string version_2_0_selected = versiontext.text = "version 2.0";     versiontext.tag = 2; } 

but versiontext.tag in first part gives me error.

enter image description here

i heard int.tryparse, can not figure out how implement code.

i hope explained enough.

my assumption of problem on line

file.copy(item.filename, mcad [versiontext.tag], true); 

specifically mcad [versiontext.tag].

.tag returns type object, array indexer expects int.

if cast it, should rid of compile error @ least.

file.copy(item.filename, mcad [(int)versiontext.tag], true); 

if versiontext.tag doesn't contain integer, you'll runtime error, however.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -