problem while working with fixed length strings in Vb.Net

G

Guest

Hello all,

I have a problem while working with fixed length stings in Vb.net

The problem is, when I call a Function FormInfo to return a FormName, which
is a string value, it is returning some numeric value (might be an internally
generated UniqueID required for that COM).

As in VB.net, there is no support for fixed length strings, how to solve
this in Vb.net

Below is the VB.6 Code

Dim sBuf as String * 256
rc = FormInfo(Table, 0, 0, FI_FORMNAME, ByVal sBuf, sSize)

Below is the Declaration of API Function to which above statement is calling

Declare Function FormInfo Lib "ff20m32l.vb" Alias "_vbFormInfo@24" (ByVal
Table As String, ByVal Form As Integer, ByVal Area As Integer, ByVal Method
As Integer, InfoRpt As Any, ByVal InfoRptLen As Integer) As Integer

Please help me to find an equivalent of the above code in Vb.Net

Thanks in Advance
 
G

Guest

I have a problem while working with fixed length stings in Vb.net
The problem is, when I call a Function FormInfo to return a FormName, which
is a string value, it is returning some numeric value (might be an internally
generated UniqueID required for that COM).

As in VB.net, there is no support for fixed length strings, how to solve
this in Vb.net

Below is the VB.6 Code

Dim sBuf as String * 256
rc = FormInfo(Table, 0, 0, FI_FORMNAME, ByVal sBuf, sSize)

Below is the Declaration of API Function to which above statement is calling

Declare Function FormInfo Lib "ff20m32l.vb" Alias "_vbFormInfo@24" (ByVal
Table As String, ByVal Form As Integer, ByVal Area As Integer, ByVal Method
As Integer, InfoRpt As Any, ByVal InfoRptLen As Integer) As Integer

The way I have solved problems like this is as follows:
Instead of InfoRpt As Any, use Byval InfoRpt as string.
Where you call your function, use
Dim sBuf As New String(" "c, 256) ' maybe 256 should be sSize?
rc = FormInfo(Table, 0, 0, FI_FORMNAME, ByVal sBuf, sSize)
An alternative is byval InfoRpt() as Byte and dim sBuf() as Byte, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top