473,669 Members | 2,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to convert LSet in VB6 to VB.Net

DH
We have a VB6 windows application. It had LSet to assign a User_Defined Type, a string, into another User_Defined Type, an Array of String. It looked like

Type tPTStrin
PTString As String * 2
End Typ

Type tPTArra
PTArray (11) As String *
End Typ

Dim PTS as tPTStrin
Dim PTA As tPTArra

PTS.PTString = "ABCDEFGHIJKLMN OPQRSTU" '--22 character

LSet PTA = PT

We got PTA.PTArray(0) = "AB", PTA.PTArray(2) ="CD",...... PTA.PTArray(11) = "TU"

What correspodent Function of LSet of VB6 we can use in VB.Net (or sample code)

Thanks

Jul 21 '05 #1
6 6969
Hi,

http://msdn.microsoft.com/library/de...angesinvb7.asp

Ken
-------------
"DH" <an*******@disc ussions.microso ft.com> wrote in message
news:8E******** *************** ***********@mic rosoft.com...
We have a VB6 windows application. It had LSet to assign a User_Defined
Type, a string, into another User_Defined Type, an Array of String. It
looked like :

Type tPTString
PTString As String * 22
End Type

Type tPTArray
PTArray (11) As String *2
End Type

Dim PTS as tPTString
Dim PTA As tPTArray

PTS.PTString = "ABCDEFGHIJKLMN OPQRSTU" '--22 characters

LSet PTA = PTS

We got PTA.PTArray(0) = "AB", PTA.PTArray(2) ="CD",...... PTA.PTArray(11)
= "TU".

What correspodent Function of LSet of VB6 we can use in VB.Net (or sample
code)?

Thanks.

Jul 21 '05 #2
Hi,

http://msdn.microsoft.com/library/de...angesinvb7.asp

Ken
-------------
"DH" <an*******@disc ussions.microso ft.com> wrote in message
news:8E******** *************** ***********@mic rosoft.com...
We have a VB6 windows application. It had LSet to assign a User_Defined
Type, a string, into another User_Defined Type, an Array of String. It
looked like :

Type tPTString
PTString As String * 22
End Type

Type tPTArray
PTArray (11) As String *2
End Type

Dim PTS as tPTString
Dim PTA As tPTArray

PTS.PTString = "ABCDEFGHIJKLMN OPQRSTU" '--22 characters

LSet PTA = PTS

We got PTA.PTArray(0) = "AB", PTA.PTArray(2) ="CD",...... PTA.PTArray(11)
= "TU".

What correspodent Function of LSet of VB6 we can use in VB.Net (or sample
code)?

Thanks.

Jul 21 '05 #3
Unfortunately Ken's link just says you can't do it in .net without really
giving you any help on where to go next

basically this is not a "typesafe" operation - you are taking a block of
memory and trying to treat it in different ways. .net does not allow you to
just play fast and loose with pieces of memory like this.

you will need to rewrite the code to represent the data in another way. for
instance you could have an arraylist of 2 character strings and then write a
method to produce the long version on demand, or you could have a single
StringBuffer and write a method to return or replace any two-character pair.

I suspect if you look at the requirement you will find out that the original
way of doing it was not a great solution and you will be able to find a much
better one using .net.

if the reason it was written like this was to give very fast performance,
you might need to experiment with several ways to do it.

Andy

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:us******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

http://msdn.microsoft.com/library/de...angesinvb7.asp
Ken
-------------
"DH" <an*******@disc ussions.microso ft.com> wrote in message
news:8E******** *************** ***********@mic rosoft.com...
We have a VB6 windows application. It had LSet to assign a User_Defined
Type, a string, into another User_Defined Type, an Array of String. It
looked like :

Type tPTString
PTString As String * 22
End Type

Type tPTArray
PTArray (11) As String *2
End Type

Dim PTS as tPTString
Dim PTA As tPTArray

PTS.PTString = "ABCDEFGHIJKLMN OPQRSTU" '--22 characters

LSet PTA = PTS

We got PTA.PTArray(0) = "AB", PTA.PTArray(2) ="CD",...... PTA.PTArray(11) = "TU".

What correspodent Function of LSet of VB6 we can use in VB.Net (or sample code)?

Thanks.


Jul 21 '05 #4
Unfortunately Ken's link just says you can't do it in .net without really
giving you any help on where to go next

basically this is not a "typesafe" operation - you are taking a block of
memory and trying to treat it in different ways. .net does not allow you to
just play fast and loose with pieces of memory like this.

you will need to rewrite the code to represent the data in another way. for
instance you could have an arraylist of 2 character strings and then write a
method to produce the long version on demand, or you could have a single
StringBuffer and write a method to return or replace any two-character pair.

I suspect if you look at the requirement you will find out that the original
way of doing it was not a great solution and you will be able to find a much
better one using .net.

if the reason it was written like this was to give very fast performance,
you might need to experiment with several ways to do it.

Andy

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:us******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

http://msdn.microsoft.com/library/de...angesinvb7.asp
Ken
-------------
"DH" <an*******@disc ussions.microso ft.com> wrote in message
news:8E******** *************** ***********@mic rosoft.com...
We have a VB6 windows application. It had LSet to assign a User_Defined
Type, a string, into another User_Defined Type, an Array of String. It
looked like :

Type tPTString
PTString As String * 22
End Type

Type tPTArray
PTArray (11) As String *2
End Type

Dim PTS as tPTString
Dim PTA As tPTArray

PTS.PTString = "ABCDEFGHIJKLMN OPQRSTU" '--22 characters

LSet PTA = PTS

We got PTA.PTArray(0) = "AB", PTA.PTArray(2) ="CD",...... PTA.PTArray(11) = "TU".

What correspodent Function of LSet of VB6 we can use in VB.Net (or sample code)?

Thanks.


Jul 21 '05 #5
Hi,

Add Imports Microsoft.Visua lBasic to the top of your file so vb.net knows
where to find lset.

Ken
----------------

"Andy Fish" <aj****@blueyon der.co.uk> wrote in message
news:8g******** *************@n ews-text.cableinet. net...
Unfortunately Ken's link just says you can't do it in .net without really
giving you any help on where to go next

basically this is not a "typesafe" operation - you are taking a block of
memory and trying to treat it in different ways. .net does not allow you
to
just play fast and loose with pieces of memory like this.

you will need to rewrite the code to represent the data in another way.
for
instance you could have an arraylist of 2 character strings and then write
a
method to produce the long version on demand, or you could have a single
StringBuffer and write a method to return or replace any two-character
pair.

I suspect if you look at the requirement you will find out that the
original
way of doing it was not a great solution and you will be able to find a
much
better one using .net.

if the reason it was written like this was to give very fast performance,
you might need to experiment with several ways to do it.

Andy

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:us******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

http://msdn.microsoft.com/library/de...angesinvb7.asp

Ken
-------------
"DH" <an*******@disc ussions.microso ft.com> wrote in message
news:8E******** *************** ***********@mic rosoft.com...
> We have a VB6 windows application. It had LSet to assign a User_Defined
> Type, a string, into another User_Defined Type, an Array of String. It
> looked like :
>
> Type tPTString
> PTString As String * 22
> End Type
>
> Type tPTArray
> PTArray (11) As String *2
> End Type
>
> Dim PTS as tPTString
> Dim PTA As tPTArray
>
> PTS.PTString = "ABCDEFGHIJKLMN OPQRSTU" '--22 characters
>
> LSet PTA = PTS
>
> We got PTA.PTArray(0) = "AB", PTA.PTArray(2) ="CD",...... PTA.PTArray(11) > = "TU".
>
> What correspodent Function of LSet of VB6 we can use in VB.Net (or sample > code)?
>
> Thanks.
>



Jul 21 '05 #6
Hi,

Add Imports Microsoft.Visua lBasic to the top of your file so vb.net knows
where to find lset.

Ken
----------------

"Andy Fish" <aj****@blueyon der.co.uk> wrote in message
news:8g******** *************@n ews-text.cableinet. net...
Unfortunately Ken's link just says you can't do it in .net without really
giving you any help on where to go next

basically this is not a "typesafe" operation - you are taking a block of
memory and trying to treat it in different ways. .net does not allow you
to
just play fast and loose with pieces of memory like this.

you will need to rewrite the code to represent the data in another way.
for
instance you could have an arraylist of 2 character strings and then write
a
method to produce the long version on demand, or you could have a single
StringBuffer and write a method to return or replace any two-character
pair.

I suspect if you look at the requirement you will find out that the
original
way of doing it was not a great solution and you will be able to find a
much
better one using .net.

if the reason it was written like this was to give very fast performance,
you might need to experiment with several ways to do it.

Andy

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:us******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

http://msdn.microsoft.com/library/de...angesinvb7.asp

Ken
-------------
"DH" <an*******@disc ussions.microso ft.com> wrote in message
news:8E******** *************** ***********@mic rosoft.com...
> We have a VB6 windows application. It had LSet to assign a User_Defined
> Type, a string, into another User_Defined Type, an Array of String. It
> looked like :
>
> Type tPTString
> PTString As String * 22
> End Type
>
> Type tPTArray
> PTArray (11) As String *2
> End Type
>
> Dim PTS as tPTString
> Dim PTA As tPTArray
>
> PTS.PTString = "ABCDEFGHIJKLMN OPQRSTU" '--22 characters
>
> LSet PTA = PTS
>
> We got PTA.PTArray(0) = "AB", PTA.PTArray(2) ="CD",...... PTA.PTArray(11) > = "TU".
>
> What correspodent Function of LSet of VB6 we can use in VB.Net (or sample > code)?
>
> Thanks.
>



Jul 21 '05 #7

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

Similar topics

19
7272
by: Lauren Quantrell | last post by:
I have a stored procedure using Convert where the exact same Convert string works in the SELECT portion of the procedure but fails in the WHERE portion. The entire SP is listed below. Specifically, I have a problem with this portion in the WHERE clause: DATEADD(Day,tblMyEventTableName.ReminderDays, @DateNow) Between CONVERT(smalldatetime,str(DATEPART(Month, @DateNow)+1) + '/' + str(DATEPART(Day, tblMyEventTableName.TaskDateTime)) + '/'...
1
1787
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance would be identical. I was 100% incorrect. The code below produces the results: CType Took: 0.2187528 seconds. Convert Took: 12.187656 seconds.
2
2109
by: Michael | last post by:
Hi, In VB6 I wrote an application that had to read lots of fixed length disk records from another system. These records were divided up into many fixed length fields. In VB6 the easy solution to breaking up the record into the fields was to define all the fields in a VB6 Type as fixed length strings and then use Lset to load the record into the type - worked a treat. However this won't work in .NET - and I haven't see any easy...
4
3619
by: Eric Lilja | last post by:
Hello, I've made a templated class Option (a child of the abstract base class OptionBase) that stores an option name (in the form someoption=) and the value belonging to that option. The value is of the type the object is instantiated with. In my test program I have Option<std::string> and Option<long>. Here's the code for OptionBase and Option along with a small helper function. In the code are comments describing my problem, look closely...
7
7100
by: whatluo | last post by:
Hi, all I'm now working on a program which will convert dec number to hex and oct and bin respectively, I've checked the clc but with no luck, so can anybody give me a hit how to make this done without strtol or s/printf function. Thanks, whatluo.
1
3034
by: Terry Holland | last post by:
I have a code builder that I use for writing my VB6 classes. I ran the Code Advisor on the generated code & found that LSet is not supported in VB.Net I use this in a number of places in my methods to store the state of my class properties in a copy of a udt Here is an example of how I use it in my CancelEdit function. ================================= Public Sub CancelEdit() If m_booIsChild Then If Not m_booIsChildEditing Then...
3
746
by: DH | last post by:
We have a VB6 windows application. It had LSet to assign a User_Defined Type, a string, into another User_Defined Type, an Array of String. It looked like Type tPTStrin PTString As String * 2 End Typ Type tPTArra PTArray (11) As String * End Typ
1
3593
by: johnlim20088 | last post by:
Hi, Currently I have 6 web projects located in Visual Source Safe 6.0, as usual, everytime I will open solution file located in my local computer, connected to source safe, then check out/check in some files and work on it. Let say, I want add new page to web project named websiteOrder.sln, i will open websiteOrder.sln in my local computer, connected to websiteOrder.sln located in Visual Source Safe 6.0(source safe located in another...
0
10753
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
0
8466
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
8896
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...
0
8810
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
8590
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
8659
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
5683
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
4387
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2798
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
2
1790
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.