I have used the conversion wizard to convert several vb6 programs. It works fine but....

I am trying to pass multi-dimensional array arguments to a subroutine which worked fine in vb6 but is not accepted in .net. The ParamArray/vb.net used at the end of the arguments only accepts one dimensional arrays. Any ideas of how to make the conversion work in .net? Making the array global eliminates the need to pass the array but that is memory intensive.

Also when I run the program using the main() as the entry point, .net runs through the code in main, but doesn't display/run the forms and then ends! It worked fine in vb6! If I enter the .net program with a form, then it doesn't see the variable declarations in the main(). Where or how should I put the declarations so the program sees them but starts with the form?

These are probably pretty basic questions, but they have me scratching my head. Any help would or direction would be very much appreciated.

Thanks,

Gary

1. You have to be very very very careful when using conversion programs. I mean vb.net is so much more different than vb it's unbelieveable.

2. Posting some code would help?

In your main() you have to call Application.Run(Form1) otherwise the program thinks you are finished.
To pass array pass them without dimension

Private Sub Calculate(ByVal myArray(,) as Integer)

Hope this helps
And as stated earlier don't count on conversion. Learn net and do the conversion yourself, you'll be better off.

In your main() you have to call Application.Run(Form1) otherwise the program thinks you are finished.
To pass array pass them without dimension

Private Sub Calculate(ByVal myArray(,) as Integer)

Hope this helps
And as stated earlier don't count on conversion. Learn net and do the conversion yourself, you'll be better off.

Wayne:

Many thanks for the quick response.

Use of commas for the passed multidimensional arrays does eliminate the build errors. Hopefully that will solve the problems. I need to pass them by ref since they are modified in the sub and the new values need to be accessed in the calling code.

I could not get the app.run(form1) hint to work because .run is not a member of the application name. I see all the subs and forms as members after I enter the app name and then the dot. Perhaps I am missing something. Any other thoughts on the syntax to call/load the form that I want to start with from main()? I know that is what I want to do, I just have to figure out the syntax to make it happen.

Your words of wisdom about learning the .net environment from scratch is good but applying it to the processes in the thousands of lines of vb6 code using the conversion wizard makes the learning process easier, faster and more relevant to me at least.

Again thanks for the help. It is muchly appreciated.

Gary

I noticed that you had app.run. Use

Public Sub main()
        Application.Run(Form1)
    End Sub

I use this code sometimes and it does work.

Sorry about the confusion. I thought application was a generic term for the name of my project/application, not the literal term. I did then try application.run(frmMainMenuNGS) which is the name of the form that I wish to go to and I then got a build error saying that frmMainMenuNGS is a type and cannot be used as an expression. Thoughts??
Gary

Try:
Dim frm As New frmMainMenuNGS
Application.Run(frm)

I tried, and it worked!!!

Short comments, concise code....life is good.

Now that the build errors/exceptions are taken care of, I can concentrate, one sub at a time, on the run time errors which may arise in the three dozen or so subroutines/functions of one project, !

Many thanks for caring to respond.:cheesy:

Gary

Perhaps you'll see queries in the future as I absorb the .net environment.

This article has been dead for over six months. Start a new discussion instead.