devxlogo

A VB Code Generator

A VB Code Generator

Sometimes you want to initialize arrays with values, but you can’t because you’d have to provide values explicitly. There is a way to generate these kinds of assignment statements.
Say you need to initialize 100 array elements:

 a(1)="c",a(2)="vb".......a(100)="c#"

It’s very tedious to write “a(1)…a(100)” manually, but you can write a program to generate the code like this:

 For I=1 to 100  Debug.Print "a(" & I & ")="""""Nextafter executing the above we will the strings like the following:a(1)=""a(2)=""

size=3>

devx-admin

Share the Post: