473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

problem while working with fixed length strings in Vb.Net

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

Jan 21 '06 #1
1 1854
> 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.

Jan 21 '06 #2

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

Similar topics

26
by: Adrian Parker | last post by:
I'm using the code below in my project. When I print all of these fixed length string variables, one per line, they strings in questions do not properly pad with 0s. strQuantity prints as " ...
20
by: titi | last post by:
Question The road and traffic authority for a small country currently uses a system to store information about all 'currently' licensed drivers. A licensed driver has the following info stored...
3
by: Andy_Khosravi | last post by:
I have been trying to build a user friendly search engine for a small database I have created. I'm having some particular problems with one of my date fields. Here's the setup: I'm using...
1
by: Tajmiester | last post by:
Hi, And thanks for any help. I am having trouble declaring a struct containing strings that can be Serialized using the following functions. It works, but the strings wont store the right number...
3
by: ecov | last post by:
Is there any easy way to read into a dataset a file that was created from a BCP command. The file is in a fixed length format. I would also like to be able to write out a dataset to the same type...
4
by: David Scemama | last post by:
Hi, I'm trying to read a database file written from a turbo Pascal program. I've set a structure to map the records in the file, but I have problem reading the file when I use VBFixedArray in...
3
by: KLomax | last post by:
VB6 allowed you to define User types that you could write to file using the statement. This is a nice way to generate fixed length text files. See Below. VB.NET does not support UserTypes with...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
6
by: Bryan Dickerson | last post by:
I have a string that is delimited, e.g. "SOD;NAME;ADDRESS1;ADDRESS2;PHONE;CITY;STATE;ZIP;EOD", that I need to strip off the "SOD;" at the beginning and the ";EOD" at the end. I am well familiar...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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,...
0
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...

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.