473,480 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Converting from UDT to structure or object - please help

I have a program that I'm converting from VB6 to VB.NET. It reads in a text
file containing barcode numbers and their corresponding descriptions. Then
the user enters the barcode number and the program finds the matching
barcode description.

In VB6 I used an UDT to store the barcode number along with the description.
Then I declared an array of the barcode UDT.

I'm thinking of converting the UDT to a structure in VB.NET and doing
something like this:

Structure BCStructure
BCNumber as Integer
BCDescription as String
End Structure

Public BC() as BCStructure

Is there a more efficient way to handle this in VB.NET? Should I setup a
barcode class and use an object collection instead? What are the
advantages/disadvantages?

All suggestions welcome
Nov 20 '05 #1
4 3066
That's OK as long as you're not going to change the number of items in the
array, because .NET arrays are immutable.

But you can use an ArrayList, or a Hashtable or any of the other container
classes.

But your approach is pretty much there.
--
Klaus H. Probst, MVP
http://www.vbbox.com/
"Clark Stevens" <cy*********@hotmail.com> wrote in message
news:9B*******************@twister.nyroc.rr.com...
I have a program that I'm converting from VB6 to VB.NET. It reads in a text file containing barcode numbers and their corresponding descriptions. Then the user enters the barcode number and the program finds the matching
barcode description.

In VB6 I used an UDT to store the barcode number along with the description. Then I declared an array of the barcode UDT.

I'm thinking of converting the UDT to a structure in VB.NET and doing
something like this:

Structure BCStructure
BCNumber as Integer
BCDescription as String
End Structure

Public BC() as BCStructure

Is there a more efficient way to handle this in VB.NET? Should I setup a
barcode class and use an object collection instead? What are the
advantages/disadvantages?

All suggestions welcome

Nov 20 '05 #2
* "Clark Stevens" <cy*********@hotmail.com> scripsit:
I have a program that I'm converting from VB6 to VB.NET. It reads in a text
file containing barcode numbers and their corresponding descriptions. Then
the user enters the barcode number and the program finds the matching
barcode description.

In VB6 I used an UDT to store the barcode number along with the description.
Then I declared an array of the barcode UDT.

I'm thinking of converting the UDT to a structure in VB.NET and doing
something like this:

Structure BCStructure
BCNumber as Integer
BCDescription as String
End Structure

Public BC() as BCStructure

Is there a more efficient way to handle this in VB.NET? Should I setup a
barcode class and use an object collection instead? What are the
advantages/disadvantages?


If that's a good solution depends on the number of barcodes. These days
we finished a project for university (written in Java :-() that was
connected to a barcode scanner to scan barcodes placed on walls. We
only had 10 barcodes in our sample, and there will never be more than
100 barcodes. So we simply used a text file containing the number
followed by a tab and followed by the description or a filename and
loaded it into an array/collection. Then we used linear search to find
the item.

Your records are very small, and if there are only few of them, using an
array is IMO a good solution. For string IDs, I would use a hashtable,
but that's not the case for simple barcode scanners. If there are lots
of items and managing them and searching is a complicated process, using
a database may be the better solution.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
The article at the link below should be helpful.

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

--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"Clark Stevens" <cy*********@hotmail.com> wrote in message
news:9B*******************@twister.nyroc.rr.com...
I have a program that I'm converting from VB6 to VB.NET. It reads in a text file containing barcode numbers and their corresponding descriptions. Then the user enters the barcode number and the program finds the matching
barcode description.

In VB6 I used an UDT to store the barcode number along with the description. Then I declared an array of the barcode UDT.

I'm thinking of converting the UDT to a structure in VB.NET and doing
something like this:

Structure BCStructure
BCNumber as Integer
BCDescription as String
End Structure

Public BC() as BCStructure

Is there a more efficient way to handle this in VB.NET? Should I setup a
barcode class and use an object collection instead? What are the
advantages/disadvantages?

All suggestions welcome

Nov 20 '05 #4
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:2j*************@uni-berlin.de...
we finished a project for university (written in Java :-() that was
connected to a barcode scanner to scan barcodes placed on walls. We
only had 10 barcodes in our sample, and there will never be more than
100 barcodes. So we simply used a text file containing the number
followed by a tab and followed by the description or a filename and
loaded it into an array/collection. Then we used linear search to find
the item.


This program will be used with a barcode scanner as well. I don't
anticipate there being a lot of records, so it sounds like I am on the right
track here. I thank you, and everyone else who responded, for your help.
This newsgroup is great!
Nov 20 '05 #5

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

Similar topics

1
4368
by: Giovanni Azua | last post by:
Hello all, I need to return back to TSQL two numeric values from an Extended Stored Procedure developed in C. As result my C dll program produces two float values, the TSQL side expects to have...
1
1683
by: Majed | last post by:
hi, I'm trying to convert some .h files to API Declaration to use the function and structs. one of it is this: NTMS_GUID CurrentLibrary; // the current library NTMS_GUID MediaPool; // media...
5
2490
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
3
2988
by: Brian Henry | last post by:
If i have a structure type and i place the structures data into a tag property (which is an object) it will go in obviously, but when i pull an object back into a structrured type it will error.....
9
5647
by: Hugo Amselschlag | last post by:
Hi there, I've implemented a local system hook to suppress certain windows beeing displayed by the axWebbrowser control. Now I need some more information before I can decide, whether to suppress...
4
3170
by: gg9h0st | last post by:
i'm a newbie studying php. i was into array part on tutorial and it says i'll get an array having keys that from member variable's name by converting an object to array. i guessed "i can...
9
2532
by: Terry | last post by:
I am converting (attempting) some vb6 code that makes vast use of interfaces. One of the major uses is to be able to split out Read-only access to an obect. Let me give you a simple (contrived)...
2
1576
by: HONOREDANCESTOR | last post by:
I've been converting a dotnet dll to a com object so that it can be called from vb6. If I want to pass a structure to a routine in the com object, like this: Call MyRoutine(byref MyStruct as...
5
9380
by: almurph | last post by:
RE: Tryign to convert Graphics object to a bitmap Hi, Hope you can help me with this. I have to open a file and add some text to it and then display it. So I create an Image object then...
0
7033
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
6903
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6726
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
6861
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...
0
5318
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,...
0
4468
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...
0
2987
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...
0
1291
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 ...
0
170
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...

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.