Multiple Instances Of System.IO.Ports.SerialPort?

Jun 3, 2010

How can I make multiple instances of System.IO.Ports.SerialPort and declare them on the fly? I need to monitor multiple RS232 ports based on the EU's selection. EU will select ports e.g. 1,2,6,9,11 and rename them as necessary. Selections will then be stored in a settings file.I would like to declare these at runtime e.g

Com1 is renamed LabelPrinter
Dim comLabelPrinter As New System.IO.Ports.SerialPort
With comLabelPrinter

[code]....

Or if not, make multiple instances based on the number of ports selected and renamed.The declaration based on the rename would just make it easier to work with but can be committed?

View 1 Replies


ADVERTISEMENT

Change The .BaudRate Property Of A System.IO.Ports.SerialPort While It's Already Connected?

Nov 18, 2010

For whatever odd reason, we have a legacy data recorder device that runs at 9600 baud. Except when it needs to transfer its recorded data to a PC, in which case it switches to 57600 baud.

The old VB6 code worked, although it had its own set of problems of course.

The routine is this: Do several COMMAND/RESPONSE routines to populate a list of available records, listed by timestamp, at 9600 baud. Once a timestamp or several are selected, display a file save dialog. At the moment that dialog is closed, send a command to the device to tell it "hey we're going to warp", sleep for 100ms, then set the baud rate property of the persistent COM1 connection to 57600, before beginning to process XMODEM data and do the progress bar dance.

The problem I'm having is that it doesn't appear that the data received is ever really kosher as far as the byte marshaling is concerned. Which makes me wonder just how well SerialPort is at dynamically changing bauds on the fly. The VB6 version used MSComm.

I've even attempted to just use MSComm through the compatibility layer but "CTL_E is not supported" which makes it sound like it's incapable of doing XMODEM. (?)

View 1 Replies

IO.Ports.SerialPort - Writes Fine, Reads Proving?

Jan 24, 2012

I'm having a bit of trouble with the SerialPort class I'm hoping someone might be able to shed some light on. Specifically, writing to the port appears to work without incident. However, reading data is proving problematic. Initially I thought it was my hardware, but testing suggested the fault lied in software. I was able to confirm this with the installation of a loopback device on the port. It tends to be missing bytes, inserting bad bytes, and shifting bytes randomly.

[Code]...

View 1 Replies

Opening Multiple Instances Of Program When Clicking System.Diagnostics.Process

Mar 28, 2012

I have an windows application (created using visual studio 2005) and it also is using an autocad .api. The user runs Autocad and the user enters various commands that will open forms. One of these forms, contains Windows.Forms.LinkLabels with paths to the autocad drawing files they've attatched (.dwg). When they click on the link, I need the file to open in the existing Autocad they already have open; however, the problem is that it's opening a new instance of Autocad and placing the file into it. How can I make it so it opens in the existing Autocad program already open? [Code]

View 4 Replies

Using A DataReceviedHandler With Multiple Com Ports?

Apr 19, 2011

I Need to be able to read an unknown number of serial ports (I plan to limit the number to 10). I'd like to use a datareceived handeler for all of them. This is what I came up with, that seems to work with my test ports. However I'm wondering if thiscould cause any problems if more data is received than I'm currently testing with. It is possible that one or two ports will be transmitting 16 records per second each. Here is the code I'm testing with:

[code]...

View 2 Replies

Multiple USB Ports With Keyboard Wedges - Add An USB ID?

Feb 24, 2011

Have several USB RFID readers that use keyboard wedge to pass info to MS Excel. That works ok. However I want to have the ID of the USB reader (port) that it came from for each read.

Need to intercept the 'read' going to the keyboard wedge and insert a USB ID number. Any reference ok as long as unique to each USB RFID reader .

View 11 Replies

Use Multiple USB Ports As Keyboard Wedges?

Oct 28, 2010

There are a lot of USB devices that collect data and setting them up as a keyboard wedge is one of the easiest ways to do it. That said, I really do not want them set up as active all the time. So is there a way to set up multiple keyboard
wedge USB devices and then through code turn them on or off. For instance, using a scanner I want to read an ID card. However once the ID has been read, I want to turn off the ID scanner so that it will not be used in the wrong field on a
different screen. Perhaps on a different screen I want to read a Credit Card set up as a wedge input device but only when I am in the correct field for the input. So in this case i would have two wedge devices

Perhaps a different way to phrase the question is, "can I set up multiple USB keyboards and through VB.net turn them off and on?

View 4 Replies

Control Which Version Of System.IO.Ports Application Uses?

Jan 16, 2009

i think there are errors in the SerialPort DataReceived Handler in .Net 3.5 and .Net 3.5 SP1. is there a way i can control which version of System.IO.Ports my application uses? i am using VB 2008 Express.

View 3 Replies

Sending Multiple Commands To A Serial Ports?

Aug 24, 2010

I am creating an application to configure some modems through the serial port. I have no problem sending a single string of data to the serial port and displaying the immediate response to a rich text box. I have 2 problems

1st: how to update the rich text box for any delayed response from the modem

2nd: how to react to the response from the modem, in other words I want to send the next command based on the response from the modem witch is usually "OK"

This is what my code looks like currently to send ans receive data from the serial port. (sport1 is my serial port and display is my rich text box)

sPort1.Write("AT+WOPEN=1" + Environment.NewLine)
With Display
.AppendText(sPort1.ReadExisting())

[Code].....

View 1 Replies

VS 2010 Handle Multiple COM Ports Using Same AddressOf Sub?

Jan 25, 2011

I've got my serial/com port code working ok using the standard Port.DataReceived handler:

AddHandler Port.DataReceived, AddressOf port_DataReceived I now want to be able to handle multiple COM ports. Do I have to create multiple copies of the handler sub or is there a way the handler sub can tell which COM port it was called for?

View 3 Replies

Opening Multiple COM Ports And Send / Receive Data

Jun 8, 2011

I am trying to set up a program that allows you to open multiple COM ports and then select which COM port you send data down. The computer i am using has 18 COM ports. Also on the first code it shows the ports are open they just wont receive anything.

[Code]...

View 1 Replies

SerialPort.ReadExisting Gives System.TimeoutException?

Jan 31, 2012

I'm trying to make a simple Class that reads data from a SerialPort.The Device returns a number of lines of Strings.

Code:Public Class Device
Private Device As New IO.Ports.SerialPort("COM4", 4800) Private WithEvents tmr As New Timer Public Event GotData(ByVal Data As String)

[code].....

View 5 Replies

'System.StackOverflowException' When Writing Data To SerialPort At Higher Baudrates?

Nov 24, 2010

I am writing a serial application using VB .net Framework V4 , where I use a background worker to Read a file and send it to a serial port using SerialPort1.writeLine method. The BackgroundWorker1.ProgressChanged Event handler sub Updates the Line Number to a TextLabel and adds each line sent to a RichTextBox using RichTextBox1.AppendText() method on main form (Form1).

The problem arises at 115200 Bauds (and higher),may be because now the text is updated real fast on the form an unhandled Exception in BackgroundWorker1.ProgressChanged Event handler sub occurs. Otherwise at lower baudrates ex: 9600,19200 etc. Application Runs Perfectly Fine.

[Code]...

View 6 Replies

Connecting To Multiple SQL Instances?

Jan 3, 2011

Any best method of managing multiple SQL connections .net (VB). My application connects to four instances of SQL Server (2000, 2005, 2008, 2008R2) restoring databases, modifying data and taking backups. In addition to managing databases the app also has its own DB (on the 2008 instance) for storing various data. I'm using two methods to connect to the instances, SMO (For backups, restoring and retrieving information about the databases, size etc) and SqlClient for querying each database for many tasks such as updating fields and executing sql scripts.I have multiple forms for performing various tasks so there are many places I'm opening / closing connections.

Would it be best to maintain a persistent global connection to each instance from the application? (Two in total, one for SMO and the other for SqlClient) or open close a connection for each task I'm performing?) I'm not using LINK as I need the tasks to be as fast as possible. The connection string will differ on each connection (Based on Instance and Database being connected to) how would I manage this? A string in the config file for the applications database would make sense, as that would be static but the databases being worked on will vary with each connection. Currently I'm creating a connection for each instance within the main form:

Dim 2000Connection = New SqlConnection("Data Source=" & SQLServerName & _
"SQL2000;Initial Catalog=Master;User ID=sa;Password=P@ssw0rd;Pooling=True;")
Dim 2005Connection = New SqlConnection("Data Source=" & SQLServerName & _
"SQL2005;Initial Catalog=Master;User ID=sa;Password=P@ssw0rd;Pooling=True;")
Dim 2008Connection = New SqlConnection("Data Source=" & SQLServerName & _
"SQL2008;Initial Catalog=Master;User ID=sa;Password=P@ssw0rd;Pooling=True;")
[Code] .....

View 1 Replies

Multiple Instances Of A Form?

Sep 13, 2010

If I create a console application for example with a class named "Person" I can create an object variable with a ceratin name only once. For example:

Module
Module1
Sub

[Code]....

View 1 Replies

Multiple Instances Of Class?

Mar 29, 2010

I have the following problem. (VB.Net 2008)I have created a class (myFirstClass). In this class there are a lot of calculations being made wich gets fired by events in that same class.Now i want that same class to be able to fire more instances of itself. However i noticed that each time i fire an event from a Sub the program waits till the event is finished before going to the next line of code. This is a problem since i want the event wich fires a new instance of the class to fire it and forget about it.

View 7 Replies

Multiple Instances Of The Same Form?

Mar 3, 2010

I have two forms in my application. Form 1 is a listview that is populated with unique Customer IDs. When the user double click the listview on the particular Customer ID then it loads Form2. Form2 has many listviews within it such as a listview for the Customer telephone, another listview for their addresses etc and all the data presented in Form2 listviews are based on the Customer ID that the user clicked in Form1.

So here is my question...I want the user to be able to open Form2 with that particular details of the customer but also to go back to Form1 and double click another Customer ID and opens Form2 again (such as replicating Form2) with the other Customer details.So the moral of the story is i want the user to be able to have many instances of Form2 open each time they wish to view a different Customer ID without having to close Form2 down every time.

View 3 Replies

VS 2008 X86, X64, PID, Multiple Instances?

Feb 6, 2010

My ultimate goal is to get a list of PIDs and have a user select 1 of them.For example: the process image name is program.exe. The application name varies for each instance the program.exe is run, and therefor each application name has its own PID associated with it. By application name I mean the Task name under the Applications tab of Windows Task Manager. Another issue I face is that some systems run x64, so the name is no longer program.exe but program.exe*32

So my issue is, how do I search for program.exe, or on x64 platforms program.exe*32, and if there are multiple instances of program.exe/program.exe*32 running, how can I get a list of PIDs for each and associated them with the application name as the Task name under the Applications tab of Windows Task Manager.that might sound a bit confusing! So if it is, please let me know and I will try to explain more. Any reference guides or example code would be greatly appriciated as I have only used the "System.Diagnostics" but once.

View 2 Replies

Adding Multiple Instances Of Same Control

Jan 14, 2011

I have a control which consists of a couple of labels and a couple of buttons side by side.I want to add multiple instances of this control to a panel.The problem I have is with positioning/formatting.Whenever I add the control it just gets added on top of the previous one.Should I be using something other then a panel? Are there any tips ot tricks I should be aware of ?

View 3 Replies

Checking For Multiple Instances Of Application?

Aug 30, 2010

How can I check for multiple instances of my visual basic application? When the user runs the application, I want to know how many instances are already open.

View 2 Replies

Communicating Between Multiple Instances Of Application?

Mar 9, 2009

I have an application which the user can open multiple instances on the same machine. However, a section of the app would have sync problems if more than 1 instance has control over it. This is where I thought of transferring control, or sharing, between them. What should I be looking into?

They would have to be able to identify which one of them has control and to send text information over. I thought IPC or Named Pipes could do the trick, but I'm unfamiliar with them and examples seem to indicate only a single server will work. Here, I have multiple instances of the same app and every one of them needs to be able to listen for that request for control.

View 25 Replies

Creating Multiple Instances Of A Form?

Aug 12, 2009

I have a form (form1) and I havea button on form1 (button1) that will start a second form (form2).How can I make it create multiple instances of form2 when button1 is clicked?i tried a process module that the studio comes as standard but it does not allow me to start multiple instances...how can i do this?

View 14 Replies

Hold Multiple Instances(10) Of Alarms?

Jul 20, 2010

I have created an alarm program but am having an issue creating multiple alarms. Here is what I have so far. I have created an array to hold multiple instances(10) of alarms that I want to run concurrently.

Code:
Dim SetAlarms(7, 9) As String
Public Shared x As Integer = AlarmNumb
'X=alarmnumb

[Code]....

What I cannot figure out is how to get the program to read the array and recognize each row as a separate alarm to process. This means it must read the array, know which variables to populate with what information and cycle thru the list.

View 5 Replies

Loading Multiple Instances Of One .dll In .Net 2010?

Sep 22, 2010

I'm working on a program that uses a COM Object exposed by a .dll. The .dll has a known bug, though, where it acts very erratically when more than one instance of the object is created under one .dll, resulting in crashes or corrupted data a large part of the time. I'm curious if there is some way I can load another instance of the .dll itself, then create another instance of the object without having to need a new process for every instance.

View 9 Replies

Multiple Instances Of A Custom Class?

Feb 15, 2009

I have a sub that runs on a button click which I want to create a new instance of a custom class and add it to a list of already created instances of this class. I want the result to be a List Of collection of all of my class instances.

My problem is that each time I run the sub, it simply 'overwrites' the first instance of the class and adds a copy of it to the list instead of writing a new instance. My code is along these lines

dim objFixture as new clsFixture
For n As Integer = 1 To intNoOfChannels
objFixture.SetChannelAddress(n, intCurrentChannelTotal + 1)
intCurrentChannelTotal += 1
next
lstFixtures.Add(objFixture)

View 7 Replies

Multiple Instances Of DCOM Singleton

May 19, 2011

Testing a configuration of a Windows 7 workstation acting as a "server" and a Windows XP workstation acting as a "client" (also fails in the same way using a Windows 7 client workstation).

[Code]...

View 8 Replies

Multiple Instances Of Forms, Same Record?

Jun 22, 2009

Good Day. Kinda banging my head against the wall on this one. I have a Mdi application with the start form(mdiparent) and form1(mdichild). On the start form, there is a textbox and a button. Heres how I want it to work:

1. value is entered into textbox and button is clicked

2. if form1 is open with that value, Bring it to the front if not, create a new instance of form1

If Not IsNothing(frmForm) Then 'If it is something
If Not frmForm.IsDisposed Then 'it's not disposed
'loop through the open form1s and compare the form1s property to the startform textbox
'if its the same, bring the form1 to the front

[code]....

View 3 Replies

Open Multiple Instances Of Same Form?

Jul 6, 2009

I am writing an application whose main purpose will be to collect user-entered data on a prescribed time interval (to be used by a dr. during anesthesia to collect patient vitals during surgery). I am attempting to accomplish this by having a form opened from the main window on every tick of a timer. The problem, is that if the user is a bit slow in entering the data on the first window, and the timer ticks again before they submit the first form, when the form is reopened (currently by simply using a show() command), the process of opening the form again simply overwrites the original form rather than creating a second instance.What is the best way to open a second (and possibly 3rd, 4th... nth) instance of the same form?

View 4 Replies

Prevent Multiple Instances Of A Form?

Jun 22, 2011

I am working on a project where i have a home form which has two buttons for login for employee and administrator.after clicking on button login form will open,but i want as soon as login window opens d previous home form must be closed or hide..also there is link on login page for home,but as soon as user click on home link new instance of home form is opening,hnce i want to stop dis multiple opening of the form.i tried close() and hide() but no use.[code]...

View 2 Replies

Preventing Multiple Instances Of A Form?

Mar 29, 2009

need help please on how to prevent multiple instances of a form at runtime in vb so tha when a user clicks a button to load a form it loads an if the user clicks the same button again whilst the other instance of the form is running it doesnt open a new one but insted sets focus on the currently running form.br2

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved