USB Ports RRS feed

  • Question

  • Good afternoon,

    Can you help me with the program code to use the USB ports. You see, i have a datalogger into a weather station. And that station is cabled with a USB into my computer. I wish to retrieve the data from it into my weather program. I working with Visual studio 2013 and writing with VBA. Is it possible that you give me a sample program code. So that i can find my way in the further.

    Regards Willem.

    Sunday, July 24, 2016 4:46 PM

All replies

  • I don't understand.  You can't write VBA in Visual Studio 2013.  Do you mean VB.NET?  VB.Net is not VBA.  VBA is for Office product automation (Word, Excel etc...).  You might find some examples in C#.  Writing/Reading from USB using VBA is very complicated since it has no direct support.
    Sunday, July 24, 2016 6:19 PM
  • Oh! Yes i think that i mean VB.Net. I have got 4.5 of .NET versions.

    I have learned that there are lanquages as C#, C++, Java and Visualbasic. And in Visualbasic you can make the choice of OLEDB or ADODB. But you are right, it is all very confusing. But i am writing in Visual basic for applications. Or in Visualbasic only, without applications. What is it? Maybe this little sample gives you an idea:

    PublicSharedReadOnlyPropertyActiveSync AsUsbDevice



    'What do i write here? To make te connection to find out which usb ports 'there are.This part is written within a class and end Class.(This comes 'out of my test program to fill the listbox.





    You see, i have written a datagridvieuw to read out a datalogger(Nexus made by TFA with software; The programmer programmed with dBase in the IDE of VisualStudio. And that programmer was able to make the connection with the USB Port and Retrieve data from it, so why can't i do the same thing as he/she did? )

    all that i need is a code sample for:

    1. Find out which USB ports there are. And which is the last used port. (There for a have made a test program with a ListBox) But a don't have the code.

    2. The code for making the connection with the active USB Port. (Open connection or so ?)

    3. The code for retrieving data (And after that: Stop reading and closing)

    And from that point a have a Insert query to save the data into the table.

    That is all. If you are willingly to help me, than i am very greatful for it. Because i think that this is the right forum. It must be.

    Regards, Willem.

    Wednesday, July 27, 2016 3:04 PM
  • You need to use the VB.Net forum.
    Wednesday, July 27, 2016 4:52 PM
  • Thank you Mogulman52. I went to VB.Net forum.

    Regards, Willem.

    Thursday, July 28, 2016 9:23 AM