473,543 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

URGENT-help regd. code coversion sample from classic vb to vb.net

Hi Guyz,

I'm developing some application using third party api. They have given me
sample project which is in VB6.0. I'm a newbie in vb.net. and the classic vb
works perfectly alright. My job is to convert this vb6.0 application to .NET

At the beginning itself i got stuck. I've no idea how to declare these kind
of variables.

a) Public Declare Function fsmGetStatus& Lib "FSMFUJI.dl l" (ByVal
strDocStatus$)
b) Public Declare Function fsmProcessDoc& Lib "FSMFUJI.dl l" (ByVal
lngPocket&, ByVal lngDoubleFeed&, ByVal strEncodeData$, ByVal
strPrintData1$, ByVal strPrintData2$, ByVal strPrintData3$, ByVal
lngStampOn&, ByVal strMICR$, ByVal strOCR$, ByRef lngPocketRet&, ByRef
lngUnitNum&, ByRef lngMICRStatus&, ByVal strDocStatus$)

When I try to convert the code, it gives me lot of error. Just give me a
clue about this. I'm stuck guyz, deadline is on my head. Your help will be
highly appreciated.

Cheerz
Nov 20 '05 #1
3 1394
On 2004-04-15, ItsMe <kk*@yahoo.co m> wrote:
Hi Guyz,

I'm developing some application using third party api. They have given me
sample project which is in VB6.0. I'm a newbie in vb.net. and the classic vb
works perfectly alright. My job is to convert this vb6.0 application to .NET

At the beginning itself i got stuck. I've no idea how to declare these kind
of variables.

a) Public Declare Function fsmGetStatus& Lib "FSMFUJI.dl l" (ByVal
strDocStatus$)


Public Declare Sub fsmGetStatus Lib "fsmfuji.dl l"
(ByVal strDocStatus As System.Text.Str ingBuilder)
That's assuming your trying to get output from the function and that it
really doesn't return a value.

You'll want to look up the type declaration characters in VB6:

$ = string
& = long

etc. Then, you'll want to convert those types to there VB.NET
equivalents. Such as Long in VB6 should be as Integer in VB.NET, since
a .NET integer is 32-bit. Using strings in declares is a bad idea if
you are recieving data (the api call is altering the string). It's ok
for constant buffers (you're passing info in, but the api call is not
altering the data), but causes a lot of extra overhead when it needs to
be altered by the external call. In those cases then you'll want to
make sure you declare the function as System.Text.Str ingBuilder. Then
you can use it like this:

Dim buffer As New StringBuilder(2 56)
fsmGetStatus(bu ffer)
Console.WriteLi ne(buffer.ToStr ing())

Anyway, hope that's enough to get you started :) If you need more
information, try looking for references to P/Invoke in the docs.

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
FORTH IF HONK THEN
Nov 20 '05 #2
Hi Tom,

Thanks a lot for the reply. I've changed my code as per your advise. Its ok
now. Please have a look

Declaration:
========
Public Declare Function fsmHVStartScan Lib "D:\DLLs\FSMFUJ I.dll" _
(ByVal lngNumDocs As Int16, ByVal strMICR As System.Text.Str ingBuilder, _
ByVal strOCR As System.Text.Str ingBuilder, ByRef lngPocket As Int16, _
ByRef lngUnitNum As Int16, ByRef lngMICRStatus As Int16, _
ByVal lngDoubleFeed As Int16, _
ByVal strDocStatus As System.Text.Str ingBuilder) As Int16
I've a slight problem here, and i'm unable to fix it.

Implementation:
==========
MsgBox(fsmHVSta rtScan(lngBatch Size, vbNullString, vbNullString, iPocket,
lngUnitNum, lngMICRStatus, lngDoubleFeed, vbNullString))

Error Message:
==========
"System.NullRef erenceException : Object reference not set to an instance of
an object.
at WindowsApplicat ion1.Module1.fs mHVStartScan(In t16 lngNumDocs,
StringBuilder strMICR, StringBuilder strOCR, Int16& lngPocket, Int16&
lngUnitNum, Int16& lngMICRStatus, Int16 lngDoubleFeed, StringBuilder
strDocStatus)
at WindowsApplicat ion1.Form1.Butt on1_Click(Objec t sender, EventArgs e) in
C:\Documents and
Settings\Admini strator\Desktop \xxx\WindowsApp lication1\Windo wsApplication1\ F
orm1.vb:line 142"

Please help........
Regards
"Tom Shelton" <to*@mtogden.co m> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
On 2004-04-15, ItsMe <kk*@yahoo.co m> wrote:
Hi Guyz,

I'm developing some application using third party api. They have given me sample project which is in VB6.0. I'm a newbie in vb.net. and the classic vb works perfectly alright. My job is to convert this vb6.0 application to ..NET
At the beginning itself i got stuck. I've no idea how to declare these kind of variables.

a) Public Declare Function fsmGetStatus& Lib "FSMFUJI.dl l" (ByVal
strDocStatus$)


Public Declare Sub fsmGetStatus Lib "fsmfuji.dl l"
(ByVal strDocStatus As System.Text.Str ingBuilder)
That's assuming your trying to get output from the function and that it
really doesn't return a value.

You'll want to look up the type declaration characters in VB6:

$ = string
& = long

etc. Then, you'll want to convert those types to there VB.NET
equivalents. Such as Long in VB6 should be as Integer in VB.NET, since
a .NET integer is 32-bit. Using strings in declares is a bad idea if
you are recieving data (the api call is altering the string). It's ok
for constant buffers (you're passing info in, but the api call is not
altering the data), but causes a lot of extra overhead when it needs to
be altered by the external call. In those cases then you'll want to
make sure you declare the function as System.Text.Str ingBuilder. Then
you can use it like this:

Dim buffer As New StringBuilder(2 56)
fsmGetStatus(bu ffer)
Console.WriteLi ne(buffer.ToStr ing())

Anyway, hope that's enough to get you started :) If you need more
information, try looking for references to P/Invoke in the docs.

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
FORTH IF HONK THEN

Nov 20 '05 #3

"ItsMe" <kk*@yahoo.co m> wrote in message
news:uc******** ******@tk2msftn gp13.phx.gbl...
Hi Tom,

Thanks a lot for the reply. I've changed my code as per your advise. Its ok now. Please have a look

Declaration:
========
Public Declare Function fsmHVStartScan Lib "D:\DLLs\FSMFUJ I.dll" _
(ByVal lngNumDocs As Int16, ByVal strMICR As System.Text.Str ingBuilder, _
ByVal strOCR As System.Text.Str ingBuilder, ByRef lngPocket As Int16, _
ByRef lngUnitNum As Int16, ByRef lngMICRStatus As Int16, _
ByVal lngDoubleFeed As Int16, _
ByVal strDocStatus As System.Text.Str ingBuilder) As Int16
I've a slight problem here, and i'm unable to fix it.

Implementation:
==========
MsgBox(fsmHVSta rtScan(lngBatch Size, vbNullString, vbNullString, iPocket,
lngUnitNum, lngMICRStatus, lngDoubleFeed, vbNullString))

Error Message:
==========
"System.NullRef erenceException : Object reference not set to an instance of
an object.
at WindowsApplicat ion1.Module1.fs mHVStartScan(In t16 lngNumDocs,
StringBuilder strMICR, StringBuilder strOCR, Int16& lngPocket, Int16&
lngUnitNum, Int16& lngMICRStatus, Int16 lngDoubleFeed, StringBuilder
strDocStatus)
at WindowsApplicat ion1.Form1.Butt on1_Click(Objec t sender, EventArgs e) in C:\Documents and
Settings\Admini strator\Desktop \xxx\WindowsApp lication1\Windo wsApplication1\ F orm1.vb:line 142"

Please help........
Regards
"Tom Shelton" <to*@mtogden.co m> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
On 2004-04-15, ItsMe <kk*@yahoo.co m> wrote:
Hi Guyz,

I'm developing some application using third party api. They have given me sample project which is in VB6.0. I'm a newbie in vb.net. and the classic vb works perfectly alright. My job is to convert this vb6.0 application
to
.NET
At the beginning itself i got stuck. I've no idea how to declare these kind of variables.

a) Public Declare Function fsmGetStatus& Lib "FSMFUJI.dl l" (ByVal
strDocStatus$)


Public Declare Sub fsmGetStatus Lib "fsmfuji.dl l"
(ByVal strDocStatus As System.Text.Str ingBuilder)
That's assuming your trying to get output from the function and that it
really doesn't return a value.

You'll want to look up the type declaration characters in VB6:

$ = string
& = long

etc. Then, you'll want to convert those types to there VB.NET
equivalents. Such as Long in VB6 should be as Integer in VB.NET, since
a .NET integer is 32-bit. Using strings in declares is a bad idea if
you are recieving data (the api call is altering the string). It's ok
for constant buffers (you're passing info in, but the api call is not
altering the data), but causes a lot of extra overhead when it needs to
be altered by the external call. In those cases then you'll want to
make sure you declare the function as System.Text.Str ingBuilder. Then
you can use it like this:

Dim buffer As New StringBuilder(2 56)
fsmGetStatus(bu ffer)
Console.WriteLi ne(buffer.ToStr ing())

Anyway, hope that's enough to get you started :) If you need more
information, try looking for references to P/Invoke in the docs.

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
FORTH IF HONK THEN


Nov 20 '05 #4

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

Similar topics

1
1697
by: Heros | last post by:
I had losed my serial key for .net Visual Studio Professional, DVD ROM with the trial version, 60 days, and need urgent to use it to install .net Visual Basic. Please, its urgent. Thanks.
3
2406
by: Rob | last post by:
I have a form - when you click the submit button, it appends a variable to the URL (e.g. xyz.cgi?inputID=some_dynamic_variable) It also opens a new page. Now, that some_dynamic_variable is actually the name of a form element on the parent window. On the new page, I have this javascript: ---- var var2 = location.search.substring(9);...
9
4288
by: Stefan Bauer | last post by:
Hi NG, we've got a very urgent problem... :( We are importing data with the LOAD utility. The input DATE field data is in the format DDMMYYYY (for days) and MMYYYY (for months). The target data format is european DD.MM.YYYY (for days) and 01.MM.YYYY (for months). The input format is not recognizable as a DATE input to a DB2 LOAD for
3
2267
by: gani | last post by:
hi, how to get the fullpath of created IsolatedStorage directory. thanks. -- gani
28
3004
by: Tamir Khason | last post by:
Follwing the struct: public struct TpSomeMsgRep { public uint SomeId;
1
1189
by: samir dsf | last post by:
hi this is kinda urgent ... i will insert some data in html format..i just need to know how to disply it back.its urgent...so if anyone can suggest pls tell me i simply need to know that if i store it in bold or something ..then how will i retreive it thnkas
2
1166
by: tulasi | last post by:
Hi, Iam plcaing some textboxes and combo boxes in rictextbox control. And am placing 2 command buttons oin the form. So when i run the application, i will enter some text in textboxes and i will select a value from combo box. and then i will clik save command button to save the contents into a file. When i click on load command button...
3
6435
by: N. Spiker | last post by:
I am attempting to receive a single TCP packet with some text ending with carriage return and line feed characters. When the text is send and the packet has the urgent flag set, the text read from the socket is missing the last character (line feed). When the same text is sent without the urgent flag set, all of the characters are read. ...
4
2944
by: Adrian Parker | last post by:
We've suddenly started getting a problem with a call to clear the contents of a DataTable. This is on a live customer site that's been working fine until yesterday. As far as we know they've not changed or updated the server in any way. "There is no row at position 42" at System.Data.RBTree`1.GetNodeByIndex(int32 userIndex) at...
1
2103
by: rajesh.us.it.recruiter | last post by:
Hi Guys/Partners, We have a URGENT Requirement for Perl Programmer with H1 visa in India/US for one of our prestigious Client. Location : New Jersey Requirements : Should be very strong in Perl Should be strong in SQL, Unix, C++ Should have some knowledge in RDBMS
0
7590
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7735
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...
1
7347
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...
0
7688
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...
0
5885
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...
1
5271
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...
0
4895
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3391
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
636
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...

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.