vb.net - Need help converting C# to vb. "array initializer is missing 1 elements" -


I am trying to use the following code from C # to the Vb 3.5 framework.

Here I am having trouble in code C #.

  MethodInfo mi = typeof (page) .GetMethod ("LoadControl", new type [2] {typef (type), typef (object [])});  

I thought it would be in VB; MethodInfo = GetType (page) as a slow mile .GetMethod ("LoadControl", New Type (2) {GetType (Type), GetType (Object ())}

But I'm getting the following error "array initializer1 element is missing"

The second line with which I'm having trouble and getting the same error

< Pre> control = (control) mi.Invoke (this.Page, new object [2] {ucType, null});

I tried to do it in vb but it does not work.

  Control = Direct Sext (m. Invoc (m.page, new object (2) {UcType, nothing}), control  

ucType Is defined as

  dim ucType type = type as it is. [GetType] (typeName (1), true, true)  

Any help would be greatly appreciated.

VB.Net arrays are 0-based, but using the highest-indexing compared to the number of items Have been declared. So a 10-item array, indexed 0..9, has been declared as the object (9).

He said, the real solution to your problem is to arrange the length of the compiler, then:

  MethodInfo = GetType (page) as a slow mile .GetMethod ("LoadControl" , New type () {GetType (type), GetType (object ())}  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -