473,466 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Late binding problems when upgrading from VB6

In my VB6 code I have added properties to several forms to change the form's
behaviour depending from where it is called and often modified these
properties in a generic function like this example:
Private Sub InsertForm(frmInsert As Form, nLabelSpace As Integer)
frmInsert.SpecialLabelSpace = nLabelSpace
End Sub
When I convert this to .NET I get this code:
Private Sub InsertForm(ByRef frmInsert As System.Windows.Forms.Form, ByRef
nLabelSpace As Short)
frmInsert.SpecialLabelSpace = nLabelSpace
End Sub
This creates an error because my added property is not a member of
System.Windows.Forms.Form.
How do I best fix this in .NET?

Thanks in advance!
Gungmas


Nov 21 '05 #1
2 940

"Gungmas" <Gu*****@discussions.microsoft.com> wrote
In my VB6 code I have added properties to several forms to change the form's
behaviour depending from where it is called and often modified these
properties in a generic function like this example:
Private Sub InsertForm(frmInsert As Form, nLabelSpace As Integer)
frmInsert.SpecialLabelSpace = nLabelSpace
End Sub
When I convert this to .NET I get this code:
Private Sub InsertForm(ByRef frmInsert As System.Windows.Forms.Form, ByRef
nLabelSpace As Short)
frmInsert.SpecialLabelSpace = nLabelSpace
End Sub
This creates an error because my added property is not a member of
System.Windows.Forms.Form.
How do I best fix this in .NET?
For this particular case, what is the purpose of calling the sub? The
calling code knows the form and the value to pass in, so why bother
calling out to a sub for one line of code?

For a more generic situation (where there may be more lines of code),
you might consider moving your form properties to a separate interface.
Then any form that supports that interface would be gaurenteed to have
the needed routines available, and your subs would all expect to be
passed an object that supports your interface:
Private Sub InsertForm(frmInsert As IFormProperties, nLabelSpace As Integer)
frmInsert.SpecialLabelSpace = nLabelSpace
End Sub

HTH
LFS
Nov 21 '05 #2

"Gungmas" <Gu*****@discussions.microsoft.com> wrote
Larry, thanks for your reply.
This was just meant as a short example, of course there are several more
lines of code in the sub.
I am not familiar with how to create/use interfaces, can you give me a short
hint how to do that?


See if this helps:

http://groups.google.com/groups?selm...TNGP10.phx.gbl

LFS
Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Mike MacSween | last post by:
Had some trouble with Word automation. Sorted it, in the process thought I would try late binding. Some people reccomend it. So this: *********************************************************...
1
by: JD Kronicz | last post by:
Hi .. I have an issue I have been beating my head against the wall on for some time. I am trying to use late binding for MS graph so that my end users don't have to worry about having the right...
14
by: Composer | last post by:
I've read many postings about the problem of Access.References.IsBroken and the consensus seems to be that late binding is the cure-all. I have a very complex Access application that needs...
9
by: Zlatko Matić | last post by:
I was reading about late binding, but I'm not completely sure what is to be done in order to adjust code to late binding... For example, I'm not sure if this is correct: early binding: Dim ws...
0
by: Rocio | last post by:
Here I go again. Some time ago I wrote a VB.NET web service application that called a COM object written in VB6 using late binding. It was the only way I could call this object (see my posting in...
30
by: lgbjr | last post by:
hi All, I've decided to use Options Strict ON in one of my apps and now I'm trying to fix a late binding issue. I have 5 integer arrays: dim IA1(500), IA2(500), IA3(500), IA4(500), IA5(500) as...
7
by: Owen Mortensen | last post by:
(This code was working in asp.net 1.1 VS2003. After upgrade to VS2005, chokes): in the aspx file: <ItemTemplate> <asp:datagrid id="dg_instr" runat="server" AutoGenerateColumns="False"...
3
ADezii
by: ADezii | last post by:
The process of verifying that an Object exists and that a specified Property or Method is valid is called Binding. There are two times when this verification process can take place: during compile...
14
by: Siv | last post by:
hi, I am converting an application that writes to an Excel spreadsheet and the code trips the "option Strict" that I would like on because the parser says "option Strict On disallows late...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.