Alternatively, create a query in access which has all the information (fields, data selected, etc) you want, then access the query and not the table in your program.

You use i in line 6 but it is not defined.

What is happening when yu run ?


I use streamwriter/streamreader for writing and reading text files. To read files you need something like

s1="path and filename"

Dim rf As New StreamReader(s1)

For writing to files you need something like

Using outp As New StreamWriter(data_path$ & Convert.ToString("weight.dat"), True)

outp.writeline (var1,var2,.....)


Don't forget you need an Imports System.IO at start of module.


If you were watching a film was laptop on carpet, bedclothes, etc. I have this and it blocks air vents, causing laptop to overheat and stop.

The moral of the story - always put your laptop on a smooth surface so air flows around it.


Thank you for your suggestions.

I have tried much of what you have suggested, so I apologose for having said so.

I have tried various opening and sending strings, including having a message box between opening the port and sending the string, for the reasons you say.

I also have a routine for scanning and finding the ports, but for testing this bit I know what the com port numbber is..

Have you sucessfully used Framework 4.5 and/or 4.6 to communicate with a port ?

Since posting I have downloaded a port monitor which appears to show my program continuing to send data. I am investigating further. I have also heard indirectly from the board makers who say I can't lock the board from VB.....

What error messages are you getting ?

DenisOxon 12 Posting Whiz

I am writing a VB.Net (VS 2015) application to control equipment in real time which is connected via USB ports. The equipment requires that text string, terminated by a chr(13) be sent. Most commands will get a response back. For example one command (set VALVE1 ON) will open a valve one on the equipment. When plugging the equipment in it appears as COM7 on my laptop, though I can change this via device manager, and have done so to ensure I don't get the problem just on COM7. the euipment then sends back a string to confirm valve has opened. A light also displays to show valve has opened.

When running my code the valve opens and about seven seconds later the coms port closes and the equipment locks up. If I use Hyperterminal or Docklight to send the string, then valve opens and string comes back.

I started using Framework 4.5 and the valve would not open. I now use Framework 4.6.1 and get the results described.

If I connect to another computer running Hyperterminal or Docklight then the sent string is displayed correctly and strings can be sent back to my application.

 Sub SendSerialData(ByVal data As String)
        ' Send strings to a serial port.

        Dim _continue As Boolean
        Dim s As String
        Dim sl As Integer
        Dim rct As Integer
        Dim CC As Integer
        Dim incoming As String

        Dim J As Integer
        J = 0
        Dim jl As Integer
        Dim bytes() As Byte

        ' Dim ascii As New ...

I assume you can get the results you want in the database with a query and report ?

If so then access the query from VB6 and do what you will with the results.

Should the slashes after website name be pointing other way ? I am not sure why you have two references to in your link


DenisOxon 12 Posting Whiz

As some of you know I am moving to from VB5. I see that to read and write to text files there are two options

1) Use System.IO.File e.g Filewritealltext ( options...)


2) Use Streamwriter e.g Dim ts as StreamWriter( options...)

Are there any differences, apart from syntax, that I should be aware of, e.g speed, memory use, etc. Both appear to do same thing if reading and ariting to text files.

To answer your question - yes it is possible.

I am not a C expert, but the principle I would use is to read in line by line. For each line see if the users' string exists. This assumes that the string you are searching for is completely on a line.

Just to let you know - project has started. Thanks for all your advice - I am going straight to VB2015.

I think the fonts used are touch big - I often CTL - to reduce the size. Other web pages I don't need to do so. If the headings were smaller and the grey bar with number of contributors, etc was half the height we would see more postings.

And what is SO, refered to earlier please ?

"I don't think daniweb site can be called a forum anymore, in the classic sense at least. It does not have a forum structure."

But don't you think time moves on and changes are almost invitable ? If you think about office blocks, the design and looks have changed over the years, but we still call them office blocks.

What would you call DaniWeb if its not a forum ?

Are you using Excel ?

if so then write your results to one sheet. Then put a page heading in, via Page layout, then hit print button. You can scale it to get more on a page, etc.

Where are you going to read the two numbers from ?

What programing language will you use ?

Are you sure these people aren't trying to track your equipment so they can steal it ? Or maybe hackers can find your equipment when you are using it ?

Exactly right HG

I am not a member of any social network, so I guess I won't be able to login ?


I know VB5 better than 6 but in this statement of yours

If Data1.Recordset.Fields("C_Number"**) = Text15.Text(i)

the index has got to be on recordset, surely, because you have multiple records in recordset and not in Text box ?

Hope this points you right direction

DenisOxon 12 Posting Whiz

If you write a post without having first logged on, then the option to loggon with DaniWeb credentials is not there. Three other loggon options are there which I don't have, but not Daniweb loggon.

If you then go to top of screen to loggon you loose what you have written, unless you you copy it first.

I think whatever forum you are on people tend not to put a sensible title on their posts. e.g 'Please help' Now that the forum is tagged based it is more obvious. Before if you saw a post in VB5 or 6, for example, wheich was titled 'Please help' then you were fairly sure you new what it was about.

Maybe you can ban words like Please and help in the title ?

I've noticed two things with USB ports

1) if you install a printer on one port, then move it to another port, it will reinstall, so the printer is listed twice in the printer dialog box.

2) on my laptop I'll plus an external hard drive in and it won't always work on some ports. Next time it will work fine on that port.

Well spotted. I would love to share it, but project is now only just about to happen.

To make myself clear - I'm not writing device driver, just using the one supplied to talk to the device. I am trying to preempt any possible problems there might be between the different versions of USB.

My guess is the device will probably be USB 3, and will only be running on later versions of Windows, so older ones won't be a problem.

DenisOxon 12 Posting Whiz

I need to interface to a USB device from, where I both read and write to the device.

Are there any programing differences between the different USB interfaces, i.e 1,2 and 3 that I should be aware ?

Does it matter if say a USB 3 device is plugged into a USB2 port ?

Thanks for your help


This is not a language that I am familiar with, but in line 6 you have
int countlev_easy = 0,countlev_med = 0,countlev_hard = 0;

In the test you appear to be comparing these variables with letters, not numbers ..........

They have already agreed that they will pay extra for any changes they ask for along the way. I like your suggestion of leaving them all until the end. If you don't leave them until end it makes testing more difficult.

Thank you for your replies, you confirmed my thoughts - go straight to new version. I have now installed Visual Studio 2015 (community edition) which is free for sole developers, like myself. It also gives opprtunity to modernise the look and feel, not that it looks particuly old. The board will use USB rather than serial,
plus differnt command to do what it currently does.

So a big learning curve - what fun.

They now want a fixed price for doing it. My gut feel says it will take me six months to do, working 3 days a week. As one post says it will take longer than one thinks. Thay are suplying a simulator for me to use, so I cn stay at home and work.

That looks fine, but I would use employee number/id, rather than his/her name.

DenisOxon 12 Posting Whiz


I have for a number of years supported a VB5 application which controls customers equipment. We are now going to do some major changes to software because hardware is changing. It now seems the ideal opportunity to upgrade to a newer/latest version of visual basic, which if we go the Microsoft route is part of Visual Studio.

First thoughts of mine suggest there are two ways of getting to latest version

1) rewrite in new version, using code from old version and converting appropiately

2) convert in steps via the various versions of VB, such that I pick the latest one that will convert existing version. For example probably convert to Vb6 first.

Has anyone else had this to do ? If so any tips please ?

Any other suggestions, different languages, other makes of VB, etc ?