473,772 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ 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 3096
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*********@ho tmail.com> wrote in message
news:9B******** ***********@twi ster.nyroc.rr.c om...
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*********@ho tmail.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*********@ho tmail.com> wrote in message
news:9B******** ***********@twi ster.nyroc.rr.c om...
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
4394
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 exactly: numeric(10, 5) and numeric. Given that the structure to fill-up is DBNUMERIC defined as:
1
1707
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 pool that the media belongs to NTMS_GUID Location; // actual location of the media
5
2527
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 applications. I am testing an upgrade of all of the sites and have converted the main root site...although not necessarily fixed any issues. I move on instead and converted one of the virtual roots that is a seperate
3
3007
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.. how do i convert the object back into a struct? here's an example public structure teststruc public name as string public id as integer end structure
9
5678
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 a window or not. My callback function get a long pointer (lParam) to a structure which contains further information. This structure is described at MSN as follows: typedef struct tagCREATESTRUCT {
4
3194
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 get public members but not protected, private, static members"
9
2579
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) example: In Project RoObjDefs: RoPerson.cls file: Public Property Get FirstName() as String Public Property Get LastName() as String <end of file RoPerson.cls> RoPersons.cls file Public Function Count() as Integer
2
1594
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 MyStructType) it works when the structure is a simple structure full of integers, dates, etc. But if the structure contains one or more strings, I get an error message when compiling the caller. Apparently you cannot pass a structure that has...
5
9423
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 import it into a Graphics object and add the text. I then try converting it to a bitmap image using the following line:
0
9619
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
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10038
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
9911
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
8934
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...
0
6713
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
5354
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...
1
4007
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
3609
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.