473,748 Members | 8,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB6 Conversion. Need help understanding how to implement fixed length string arrays..

I am trying to convert a vb6 project to vb.net. The conversion worked for
the most part except for the fixed length strings and fixed length string
arrays. Bascially the vb6 programmer stored all form data in a fixed length
structure that is written direct to disk.

I need to load the existing files, into a fixed length structure to
initialize the form data within the project.

I am running into problems with statements like the following..

Original vb6 code looked something like:

Type formcfg
'General
CustId As String * 40
CellIdParam(0 To 7) As String * 8
end type

Public c As formcfg

The c structure is loaded with a routine like:

Open File$ For Random As #1 Len = Len(c)
Get #1, 1, c
Close #1

After converting to vb.net I see this code:
'UPGRADE_WARNIN G: Fixed-length string size must fit in the buffer. Click for
more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="3C1E4426-0B80-443E-B943-0627CD55D48B"'
<VBFixedString( 40),
System.Runtime. InteropServices .MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.ByVa lArray,
SizeConst:=41)P ublic CustId() As Char

and

'UPGRADE_ISSUE: Declaration type not supported: Array of fixed-length
strings. Click for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="934BD4FF-1FF9-47BD-888F-D411E47E78FA"'

Dim TestParam(7) As String * 8

How do I recreate the functionallity that I need to work with these saved
structure files that are fixed length..? The fixed length strings have -1
appeneded to the end and therefore increase the size by 1. Is there a way
to handle this type of problem?
Thanks..

-Rick
Feb 16 '07 #1
1 9434
CustId As String * 40
CellIdParam(0 To 7) As String * 8

can change to

<VBFixedString( 40)>Dim CustID As String
<VBFixedString( 8)Dim CellIdParam(0 To 7) As String
-----
And
Dim TestParam(7) As String * 8

is

<VBFixedString( 8)Dim TestParam(7) As String

VB.net really doesn't use fixed length strings since it allocates memory,
and in turn resources.

You can get away with....
Dim CustID As String
- or if you need the length
Dim CustID(40) As String

same with:
dim CellIdParam(0 To 7) As String

and
Dim TestParam(7) As String

Hope this helps.
"Rick Knospler" <no**********@s kylands.netwrot e in message
news:xT******** *********@fe167 .usenetserver.c om...
>I am trying to convert a vb6 project to vb.net. The conversion worked for
the most part except for the fixed length strings and fixed length string
arrays. Bascially the vb6 programmer stored all form data in a fixed
length structure that is written direct to disk.

I need to load the existing files, into a fixed length structure to
initialize the form data within the project.

I am running into problems with statements like the following..

Original vb6 code looked something like:

Type formcfg
'General
CustId As String * 40
CellIdParam(0 To 7) As String * 8
end type

Public c As formcfg

The c structure is loaded with a routine like:

Open File$ For Random As #1 Len = Len(c)
Get #1, 1, c
Close #1

After converting to vb.net I see this code:
'UPGRADE_WARNIN G: Fixed-length string size must fit in the buffer. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="3C1E4426-0B80-443E-B943-0627CD55D48B"'
<VBFixedString( 40),
System.Runtime. InteropServices .MarshalAs(Syst em.Runtime.Inte ropServices.Unm anagedType.ByVa lArray,
SizeConst:=41)P ublic CustId() As Char

and

'UPGRADE_ISSUE: Declaration type not supported: Array of fixed-length
strings. Click for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?ke yword="934BD4FF-1FF9-47BD-888F-D411E47E78FA"'

Dim TestParam(7) As String * 8

How do I recreate the functionallity that I need to work with these saved
structure files that are fixed length..? The fixed length strings have -1
appeneded to the end and therefore increase the size by 1. Is there a way
to handle this type of problem?
Thanks..

-Rick

Feb 16 '07 #2

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

Similar topics

30
5063
by: Tim Johansson | last post by:
I'm new to C++, and tried to start making a script that will shuffle an array. Can someone please tell me what's wrong? #include <iostream.h> #include <string.h> int main () { srand(time(0)); int array_length; int count;
7
3840
by: guy | last post by:
Has anyone any experience of the conversion wizard for VB6 to VB2005? if so how good is it? also how does it handle database related conversions i.e is ADO converted to ADO.NET etc. the project is approx 60 forms with so approx 180 to 240 classes The back end was and remains S!L Server 2000
19
6250
by: ern | last post by:
I need a FIFO queue of size 20, to keep track of a running average. Once the queue is full with 20 values, I want to take the sum/20 = AVERAGE. Then when a new value comes in, I want: (Old Sum - oldest value + newest value)/20 = New Average Anybody know an efficient way to implement that? Is a queue even the best way? Thanks,
0
1524
by: Ken Varn | last post by:
I have a managed C++ assembly in which I need to interact with some 'C' APIs that take fixed size 'C' data blocks. I need to wrap these data blocks into a managed object. It seems like a lot of redundancy and extra code to have to marshal .net data from managed to unmanaged for this. Is there some built-in method in managed C++ that can allow me to create a managed structure and convert it into a fixed size 'C' data block? I am trying...
11
2702
by: jyck91 | last post by:
// Base Conversion // Aim: This program is to convert an inputted number // from base M into base N. Display the converted // number in base N. #include <stdio.h> #include <stdlib.h> #include <string.h> #define LENGTH 20 int temp, m, n, i, r, base10, true;
3
4750
sammyboy78
by: sammyboy78 | last post by:
I'm trying to display an array of objects using a GUI. My instructions are that the CD class and it's sublcass don't need to change I just need to modify class CDInventory to include the GUI. I'm not even sure if the way I've written this is going to work but anyway, I keep getting a compilation error that says: C:\Documents and Settings\Sam\GUICDInventory.java:22: cannot find symbol symbol : constructor JList(CDInventory) location: class...
0
27257
by: maheshmohta | last post by:
Background Often while remodeling legacy application, one of the important tasks for the architects is to have an optimum usage of storage capabilities of database. Most of the legacy applications are constrained by the technology available at the time of their development and hence aren’t optimum as per current scenario. One of such cases is the extensive usage of CHAR fields, which aren’t optimum solution for space storage now. This paper...
43
2383
by: John | last post by:
Hi This .net is driving me crazy!! In VB6 I had a type which contained a couple of multi-dimentional arrays which i used to create and read records: Type AAA : Array1(10,10,2) as Integer
0
8989
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
9537
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9319
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
8241
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
6795
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...
0
6073
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4599
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.