Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi All,

 

I have been working with VB.Net for 2 weeks already. My task for now is to

migrate a VB6 program to VB.Net.

 

Right now I have encountered a probelm during migration. The scenerio is as

follow:

 

in VB6,

i have an Active X user control "Monthly", i call it "Monthly_Day" (and yes,

it is a calendar program). For this control, i have all the standard events

(such as click, double click....) implemented as well as some user defined

methods (for example, "Reset")

 

i have a form, i call it "frm_Monthly". Inside this form, i have "drawn" 42

Monthly ActiveX controls. Logically, it's placed in a control array. There

is a segment of code like the following:

for i = 0 to 41

Monthly_Day(i).Reset

next i

 

I decided to leave the Monthly controls as is. (i.e. it stays as Active X )

 

After i finish the migration, I see that the widzard has created a new

class, called "MonthlyArray", for me. (please see the attachment for

reference)

in the Windows Designer Generated Form section, i see the following

statement:

"Public WithEvents Monthly_Day As MonthlyArray"

 

I'm able to compile and run the program without syntex error. However, when

it runs to the loop mentioned above, it gives me an error message: (91)

Object Reference not set to an instance of an object.

 

 

Any information regarding to my problem will be greatly appreciated.

 

THank you in advance.

 

 

Anson

monthlyarray.vb

  • *Experts*
Posted

I really don't recommend using the VB6 Migration Wizard at all. It generates terrible code that is hard to maintain and is very messy. It'll just create more work for you.

 

I really recommend rewriting the project if possible. It will make things much easier to maintain and expand.

  • Administrators
Posted

Would probably save a lot of time in the long run to re-write. However if you step through the code when it reaches the line

 

Monthly_Day(i).Reset

 

what is the value for Monthly_Day in the watch window?

what is the value for Monthly_Day(i) in the watch window?

 

also does Monthly_Day(1) resturn a valid result?

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

  • Administrators
Posted
That's the problem. The array will need to be instantiated somewhere in the form. Good luck in figuring out where though, as VolteFace said earlier the Wizard tend to write out code that is very poor quality and fairly long winded and incomprehensible.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...