vb6.0 porting problem

ram123

Member
Joined
Mar 25, 2008
Messages
5
Programming Experience
1-3
I’m facing small problem while I’m trying to convert the vb6.0 form resize code to vb.net.

I converted the vb6 resize.dll to myresize.dll using tlbimp.exe

Here we have two methods in the resize.dll

They are

1) Sub InitResizeClass(ByRef FRM As Object)

2) Sub ResizeControls(ByRef FRM As Object)

Here is the vb6 code

****************************

Option Explicit

Private Temp_Class As Resize_Class

Private Sub Form_Load()

Set Temp_Class = New Resize_Class

Temp_Class.InitResizeClass Me

End Sub

Private Sub Form_Resize()

Temp_Class.ResizeControls Me

End Sub

***************************

I’m expecting the same in vb.net

Here is the code how I tried

**********************

Dim ourresize As New Resize_Class

ourresize.InitResizeClass(Me) //Here it is saying that invalid castException

please help me
 
I would question why you're doing this at all in the first place. With TableLayoutPanel and FlowLayoutPanel controls, Anchor and Dock properties it's pretty much a dead ceryainty that your code is not needed at all.

As to the question, are you saying that you're actually passing a .NET Form object to a VB6 procedure and expecting to be able to treat it as a Form? If so then that's probably the issue, as they aren't the same thing.

Just get rid of the VB6 code altogether and explain what functionality you're trying to implement. Then we can advise how to achieve it in VB.NET without any VB6 influence messing things up.
 
vb6.0 to vb.net porting problem

Hi jmcilhinney

Thanks for your reply.

I want to resize the form controls according to the Form.
I tried using dock and anchor properties in vb.net but the controls are not resized proportinately.

Font size is also not increasing.if i increase horizontally it ok but if i increase vertically the resize is not working.

Please help me.
 
Back
Top