473,624 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vb 6.0 naar vb.net 2005

Hallo,

Ik probeer een programma, gemaakt in vb 6.0 te openen in vb.net 2005.
Bij het runnen zijn er enkele problemen opgetreden. Ik denk dat het
probleem bij geheugens ligt, declaratie van variabelen die bij het
omzetten naar .net zijn verandert of iets is fout gelopen. Kan het zijn
dat ik internal pointers of zo moet gebruiken? Wie kent hier iets van?
Hoe kan ik een vb 6.0 applicatie laten werken in .net 2005?

Greetz klenne

Oct 6 '06 #1
7 1393
Hi Klenne,

although Cor, opa vito, Pieter, me and some other people are able to read
your post, you probably will get more response when posting in english.

Greetz,

Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

"klenne" <ba********@gma il.comschreef in bericht
news:11******** *************@i 3g2000cwc.googl egroups.com...
Hallo,

Ik probeer een programma, gemaakt in vb 6.0 te openen in vb.net 2005.
Bij het runnen zijn er enkele problemen opgetreden. Ik denk dat het
probleem bij geheugens ligt, declaratie van variabelen die bij het
omzetten naar .net zijn verandert of iets is fout gelopen. Kan het zijn
dat ik internal pointers of zo moet gebruiken? Wie kent hier iets van?
Hoe kan ik een vb 6.0 applicatie laten werken in .net 2005?

Greetz klenne

Oct 6 '06 #2
klenne wrote:

(Translation attempted by BabelFish.AltaV ista.com)
I try a programme, made in vb 6.0 to open in vb.net 2005. at
managing some problems have appeared. I think that the problem lies
at geheugens, claim of variables which are at converting to net
change or something error has run. Can it be that I internal must
use pointers or this way? Who know of this does something?
How can I leave a vb 6.0 application work in net 2005?
"I try a programme, made in vb 6.0 to open in vb.net 2005"
Another failed "upgrade" attempt.

"How can I leave a vb 6.0 application work in net 2005?"
You can't.
Whilst they may share "Basic" in their names, these are two totally
separate products with radically different ways of doing things.
To get a VB2005 application that works anywhere /near/ as well as its VB
"Proper" predecessor, you are looking at rewriting it.

Regards,
Phill W.
Oct 6 '06 #3
Hallo,

I'm trying to open a program which is originally written in vb6.0, in
vb.net 2005.
When i try to run the program an error occurs. My guess is that the
problem lies in the fact that the type of adressing the memory is
changed. Therefor the translation to vb.net of the declaration of the
variables isn't correct.

perhaps its best that I will explain my program a liltle bit.

I am supposed to write a vb.net 2005 application that allows
communication between a PC (master) and a plc (slave) true the modbus
protocol with a rs232 cable.

The PC has to be able to read- write data to the plc and show it in the
program. Since the read and write error are the same I will explain the
read error.

So the basic idea is: From my main form ( where i can enter the mode
(read or write), the starting adres, number of registers i want to
read) a module is being called up (i send the mode, number of register,
starting register and such also to the module).

In this module a DLL is being called up (and again the mode, number of
register, starting register and such is send to the dll aswell) the dll
is in the system32 directory. The dll will then use the data from the
starting register, number of register to form a good modbus protocol
message.

code to enter the module with the appropriat declarations:

Private Sub ReadShort_Click (ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArg s) Handles ReadShort.Click
Dim BusState As Integer ' Een aantal shorts van de HPC lezen
Dim handle, j As Integer
Dim Ready As Boolean
Dim Address As TBusAddress
Dim Data As TShortData

MBRead( handle, j, 1,
mbShort,CShort( Startadress.Tex t),Short(number ofRegisters.Tex t) )

This will call up the module and go to the function MBread

Declare Function MBRead Lib "Modbus" Alias "VBMBReadReques t" (ByRef
handle As Integer, ByVal UserData As Integer, ByVal NodeNr As Short,
ByVal VarType As Short, ByVal StartAddress As Short, ByVal Count As
Short) As Short

This function forms the request that is send to the PLC, so far so
good.

Now the plc send a message back (which he actually sends, so that aint
the problem) which I will catch with the function

Ready = MBGetShorts(han dle, j, BusState, Address, Data) <= is in the
main form

Again the module is being called up.

Declare Function MBGetShorts Lib "Modbus" Alias "VBMBGetShortRe sults"
(ByVal MBHandle As Long, ByRef UserData As Long, ByRef BusState As
Integer, ByRef Address As TBusAddress, ByRef Data As TShortData) As
Boolean

The function MBgetShorts catches the response from the plc and puts the
register data in the DATA aray. But from here it goes bad.

At the line "Ready = MBGetShorts(han dle, j, BusState, Address, Data)"
the program stops and shows the error.

FATALEXECUTIONE RROR:
error may be a bug in the CLR or in the unsafe or non-verifiable
portions of user code. Common sources of this bug include user
marshaling errors for COM-interop or PInvoke, which may corrupt the
stack.

The program works correct in VB6.0, you fill in the correct registers,
starting adres and mode and then the module and DLL form the request
which is send to the PLC, the plc sends a message back and the DLL and
module collect the DATA from the registers and shows it on the computer
screen.
Someone told me that it might get fixed if i used internal pointers.
Anyone knows if this will solve my problem or any other ideas???

Thx
Klenne
ps: if you dont understand me cause of my bad english phrases please
ask and ill try to reform the phrase.

Oct 6 '06 #4
klenne wrote:
Again the module is being called up.

Declare Function MBGetShorts Lib "Modbus" Alias "VBMBGetShortRe sults"
(ByVal MBHandle As Long, ByRef UserData As Long, ByRef BusState As
Integer, ByRef Address As TBusAddress, ByRef Data As TShortData) As
Boolean
Is this the declaration you used in VB6? If so, then it is probably
incorrect for VB.Net. Integers are now 32 bit and Longs are 64 bit.
You may wish to change them to Short and Integer respectively.

Oct 6 '06 #5
Chris Dunaway schreef:
klenne wrote:
Again the module is being called up.

Declare Function MBGetShorts Lib "Modbus" Alias "VBMBGetShortRe sults"
(ByVal MBHandle As Long, ByRef UserData As Long, ByRef BusState As
Integer, ByRef Address As TBusAddress, ByRef Data As TShortData) As
Boolean

Is this the declaration you used in VB6? If so, then it is probably
incorrect for VB.Net. Integers are now 32 bit and Longs are 64 bit.
You may wish to change them to Short and Integer respectively.
This is the declaration of VB.net,

the declarations for the VB6.0 are
Declare Function MBGetShorts Lib "Modbus" Alias "VBMBGetShortRe sults" _
(ByVal MBHandle As Long, _
ByRef UserData As Long, _
ByRef BusState As Integer, _
ByRef Address As TBusAddress, _
ByRef Data As TShortData) As Boolean

So this should be correct

Oct 6 '06 #6
klenne wrote:
Chris Dunaway schreef:
klenne wrote:
Again the module is being called up.
>
Declare Function MBGetShorts Lib "Modbus" Alias "VBMBGetShortRe sults"
(ByVal MBHandle As Long, ByRef UserData As Long, ByRef BusState As
Integer, ByRef Address As TBusAddress, ByRef Data As TShortData) As
Boolean
>
Is this the declaration you used in VB6? If so, then it is probably
incorrect for VB.Net. Integers are now 32 bit and Longs are 64 bit.
You may wish to change them to Short and Integer respectively.

This is the declaration of VB.net,

the declarations for the VB6.0 are
Declare Function MBGetShorts Lib "Modbus" Alias "VBMBGetShortRe sults" _
(ByVal MBHandle As Long, _
ByRef UserData As Long, _
ByRef BusState As Integer, _
ByRef Address As TBusAddress, _
ByRef Data As TShortData) As Boolean

So this should be correct
If that is the VB6 declaration, then your VB.Net declaration is wrong.
MBHandle should be Integer in VB.Net or even IntPtr, UserData should
be Integer, BusState should be Short. Not sure about TBusAddress and
TShortData.

Oct 6 '06 #7
Not sure about TBusAddress and TShortData.

I declared TBusAdress and TShortData like this

Structure TBusAddress
Dim NodeNr As Short
Dim VarType As Short ' mbE, mbA, mbAE, mbAA, mbMerk, mbChar, mbShort
of
mbLong
Dim StartAddress As Short
Dim VarCount As Short
End Structure

Structure TShortData
<VBFixedArray(6 3)Dim ShortData() As Short '
-32.. -+32.. , 2 bytes
Dim ShortData() As Short
' -32.. -+32.. , 2 bytes

Public Sub Initialize()
ReDim ShortData(63)
End Sub
End Structure

About the vbfixedArray i aint sure if thats correct

Greetz,
Klenne

Oct 9 '06 #8

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

Similar topics

2
1889
by: R. van Lieshout | last post by:
Ik wil een link naar een .doc bestand maken die direct opent in MS Word en niet in de internet explorer kan iemand mij hier bij helpen want in Dream Weaver kan ik het niet vinden en na wat rond vragen krijg ik het antwoord dat dat nogal moeilijk is. Het moet toch kunnen? Graag reacties
1
2767
by: embee4u | last post by:
Help ! Ik gebruik een macro om een query uit te voeren naar ExceL. Dit werkt perfect. Nu wil ik echter dat het Excel-bestand als bestandsnaam de inhoud van een formulierveld gebruikt (formulier staat open). Wat ik ook invoer bij "uitvoerbestand" (dingen als !! ; (!!) ;= !! ; ...) ik krijg steeds een "file" met als bestandsnaam datgene wat ik had ingevuld bij uitvoerbestand (zelfs met de tekens die normaal niet
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8619
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8334
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8474
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6108
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.