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


ADVERTISEMENT

VS 2010 : One Class To Handle Multiple Dynamic User Controls?

Apr 3, 2012

I have multiple user controls (the same one dynamically added to a form 4 times), and one class. I would like all of the user controls raise events in that one class. For example, if any of the user controls are clicked, I want it to send a string to the class to be processed and show a MsgBox "Control name was clicked"I am doing this as an exercise to reduce repeating the same code over and over directly in the control, and to avoid creating the class over and over to accompany each user control.

View 1 Replies

NET 4.0 Parallel.ForEach AddressOf Multiple Values?

Nov 5, 2011

I am trying change from Delegates to Parallel.ForEach I see the below works fine. Imports System.Threading.Tasks

Sub Main()
Dim secs() As Integer = {2, 3, 1}
Parallel.ForEach(secs, AddressOf Method2)
End Sub

[Code]...

View 2 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

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

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

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

Add A Handle Ex. With A Button "AddHandler CType(obj, Button).Click, AddressOf Button_Clicked"?

Oct 31, 2009

I how how to add a handle ex. with a button "AddHandler CType(obj, Button).Click, AddressOf Button_Clicked", but Button has an event called click. I have a control for which I would like to create an event called MoveUp, which is triggered when a button is clicked.

View 2 Replies

VB 2010 And Com Ports

Apr 10, 2012

I will explain first what kind of program we are talking about: The program that I made works togehter with my PIC Microcontroller to control 2 stepper motors. One for the rotating motion and the second for a tilting motion. With this system I want to make a airplaine pointing and tracking system.

[Code]...

View 1 Replies

VS 2010 List (Of Timer) With Each .Elapsed Being Set To The Same AddressOf MyTimerEvent

Sep 4, 2011

I effectively have a List (Of Timer) with each .Elapsed being set to the same AddressOf MyTimerEvent

When MyTimerEvent is called, how do I know which particular timer from the list triggered it?

View 5 Replies

Multiple Objects In One Handle?

Sep 18, 2009

I have a handle event that takes care of about 50 buttons. Is there a way to determine which button is being clicked when the event is handled? I have tried using the FromHandle, but I can't seem to get it to work.

View 4 Replies

Events - How To Handle Multiple Textboxes

Aug 9, 2010

I have multiple textboxes which I want them to perform the same thing upon clicking them. By default I can use the handles textbox1.click for 1 single textbox but I am not sure how to do handle multiples of them. Of course I can write a handler for every single textbox but I have about 50.

Sub TextBox1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.Click
If Button9.Text = "Make Changes" Then
If TextBox2.Text <> "" Then
Frm_Cine1.Show()
[Code] .....

View 1 Replies

Handle Multiple Dropdown Lists In ASP.net?

Aug 16, 2011

One of my clients wants a set up multiple dropdown lists as a set of outbound links (yes, I cringed too, but he does have his reasons. there are 3 dropdowns, each one pertaining to its own group of links. When each dropdown has its SelectedIndexChanged, it then redirects based on the choice made. However, lets say I make a choice in the second dropdown. It goes to the proper link. If I then choose a link in the first dropdown, it goes to the proper link. Then if I select a link in the third dropdown, it will go to the link specified in the choice I made in the FIRST dropdown.

How can I code it so that it will always select the most recent selection?

View 3 Replies

Handle Multiple MouseHover/Leave?

Jul 30, 2011

VS 2010 How to Handle Multiple MouseHover/Leave?

View 34 Replies

How To Handle Processing Multiple Commands

Jul 15, 2010

I am making a program which will read data from csv and pick up Username & Computer name from the csv.

Then it will run commands via telnet with those username and computer on line at a time. I have reached this goal without any problem. I wanted to paste the code here but its too much.

Basically what i now want to do is have a option for user to skip a command.

Like if csv have 3 users in it. i.e.

j.doe, comp1
t.test, comp2
u.user, comp3

Popup will come and say do you want to run the command "add user j.doe, comp1" something and you will have option to say Yes, No , Cancel.

Where yes will run the command and no will skip that user (go to next one) and cancel will end the whole process.

I know Msgbox yes,no is there but i dont know how to skip that user.

Following is the code which migh

vb
Dim objCmdSelect As New OleDbCommand("SELECT * FROM " & fileNam & "", objConn)
For i = 0 To objDataset1.Tables(0).Rows.Count - 1

[Code]....

View 2 Replies

VS 2008 Handle Multiple Mousehover?

Nov 22, 2009

i've created an array of checkboxes like this

CheckBoxesArray = New CheckBox() {CheckBox1, CheckBox2, CheckBox3, CheckBox4, CheckBox5, CheckBox6, CheckBox7, CheckBox8, CheckBox9, CheckBox10, CheckBox11, CheckBox12, CheckBox13, CheckBox14, CheckBox15, CheckBox16, CheckBox17, CheckBox18, CheckBox19,

[code]....

View 15 Replies

Handle Multiple Moving / Scrolling Labels

Feb 25, 2010

I have an application which I've designed to relay information on a large screen, like news feeds etc. It scrolls labels inside panels so the text moves in a readable fashion. It actually works quite well but it seems to struggle sometimes by consuming too many CPU cycles. I've turned on double-buffering on the form as I remember this graphics method from years ago. This improves the display drawing in general but I am still getting flickering and sometimes the scrolling slows down considerably.

[Code]...

View 2 Replies

How To Handle Retrieving Data From Multiple Tables

Jan 4, 2009

I am new to VB and I have a database that has three related tables. These tables show information about computer engineers.
table one is engineers details
table two is engineers allocated
table three is jobs

My form needs to have buttons where a user can obtain information
View details of all Engineers
View Names of all the Engineers working on a specified job.
Add a new engineer

I have set up the connection to the data base using the wizards and also made the dataset. How to handle retrieving the data from multiple tables.
Here is a screen shot of my data set

View 3 Replies

Sub To Handle Multiple KeyPressEventArgs (null Reference)?

Apr 22, 2011

I am using KeyPressEventArgs to restrict several text boxes to numeric entries only. Rather than repeat the code, I thought I would make a "RestrictToNumeric" subroutine and call it from each "KeyPress" event. Like So:

Private Sub txt1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txt1.KeyPress
RestrictToNumeric()
End Sub

[code].....

The problem I am encountering is that the variable 'e' is used before it has been assigned a value, causing a null reference at runtime.

So I tried to add Dim e As System.Windows.Forms.KeyPressEventArgs As?to the RestrictToNumeric sub.I cannot figure out what I need to "Dim" it as...

View 2 Replies

Unable To Handle Multiple Deposits Or Debits?

Sep 12, 2010

I am making a checkbook balancer and so far so good. But, I need it to be able to handle multiple deposits or debits. The line for it is below:I need it to first do what is in the first grouping box (deposit or withdraw), and then handle the second, and then the third. Here is the coding for the Apply button:

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code]...

View 4 Replies

Handle Bill - No Series Number For Multiple User

Oct 16, 2010

I am created a Vb.net ERP Application! In this application I handle core accounting concepts. I have handled Salebill and many of accounting form. I take salebill billno from Database by selecting maximum srno from salebill Table but whenever multiple user trying to access this form at a time, everyone gets same billno. How I handle this situation to show different bill no to different users?

View 4 Replies

Instr Function Handle Multiple Strings To Find?

Aug 1, 2010

I'm using this for a single value to search for.

intPositionOfApartment = InStr(StrConv(pStringToParse, vbUpperCase), "APT") Is it possible to search for more then one value such as "APT", "UNIT" ?

If yes please show me an example of how it should be coded.

View 4 Replies

Server Handle Multiple Clients Simultaneosly At An Instance?

Sep 22, 2011

I am facing a problem in VB .net Client/Server application where I am successfully able to talk between them using TCPListener and TCPClient class usage. However, when I try to connect another Client to the same server on the same welcome port, it errors out throwing an exception or behaves very unexpectedly.Isn't it true that the Server connection is on a WELCOME PORT for all the clients, and that each client connected gets a new port to carry on its communication with the server AUTOMATICALLY (according to the Tomcat webserver working)

View 2 Replies

VS 2008 - Handle Leave Event For Multiple Textboxes

Aug 23, 2011

Is there another way to handle the leave event of multiple textboxes other then coding in each event handler? I may not be using correct terms instead of doing this: (Existing)
Private Sub leveladjstvaltxt_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles leveladjstvaltxt.Leave
If Me.leveladjstvaltxt.Text <> "" Then
Dim levels As Integer = CInt(Me.leveladjstvaltxt.Text)
Me.leveladjstvaltxt.Text = Format(levels, "#,###")

I have 30 TextBoxes all need same formatting , so I was trying to come up with something like this: (trying)
For Each ctrl As Control In Me.Controls
If TypeOf ctrl Is TextBox And ctrl.Text <> "" Then
Dim val As Double = CDbl(ctrl.Text)
CType(ctrl, TextBox).Text = Format(val, "#,###")
End If

I am stuck though and don't know where I would place that code if this is something that is even possible. Only thing I can currently think of is in the leave event which defeats the purpose, I wanted to avoid having to place the code in 30 different textoxes leave event.

View 5 Replies

Handle Events And Notifications From Multiple Sources To A Main Form In .net?

Sep 23, 2011

I have a vb.net application in which there is a main form. There are around 10 classes each having their own functionalities like tcpactions, fileactions, serialport actions etc. The user interacts with the main form and does certain actions which will invoke the methods in these classes. Now I have a notifications textarea in the mainform and i want to show the current action being performed in those classes and their results in the notifications area.

for example when a user clicks a "Start Process" Button in the form i invoke the method "launchprocess" in a class "ProcessActions". Now this method tries to launch about 7 different process and after launching it sends notification such as "process 1 launched" or if it fails it sends notifications such as "process 1 launch failed".

I currently use event handlers and use them to show notifications but with the amount of events i have to handle it is getting cumbersome and i might have to add even more classes in the future. So is there a better way of handling notifications from other classes.

View 1 Replies

One Routine To Handle Multiple Events In Arraylist Class Object

Oct 17, 2011

I want to use One routine to handle multiple events & i want to give the list class object to the routine handle clause in vb.net. Is it possible? I have 100 buttons on my web page & i want to handle click event of each button. I have same coding on each button but the only difference is that, which button is calling the event handling routine. So i want to make one sub routine for handling event of all my buttons.

I can solve this by writing each button name in the handles clause like - Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImgRCP_26.Click, ImgRCP_27.Click,. But it is so lengthy procedure. So that why i want to handle my button in the arraylist. How to do this?

View 1 Replies

Make Single Sub Handle Keydown Event For Multiple Text Boxes

May 14, 2011

I don't have an example code, but recently figured out how to make a single sub handle the keydown event for multiple text boxes.What I would like to know is if it is simple enough to have the object name that is sending the event instead of "microsoft..text: 54654" (sender.ToString in a debug window) type of return. I don't know how to make use of that.

View 3 Replies

VS 2010 - Too Much For The UI Thread To Handle

Jan 22, 2011

I've got a form that acts as a progress report for a long running operation, it has a listview on it (which I might be replacing with a DGV soon) that gets updated with progress updates from a background thread that is doing all the work. The method running on the background thread raises events that the form then handles and adds the string passed in to this event to the listview. The method running on the background thread raises progress update events several times a second and for each of these updates the event handler on the form must invoke a method on the UI thread to actually add the item to the listview.

This works fine on my test PC (which has a quad core CPU and 8 GB of RAM) but others have reported that after a while the form goes to the Not Responding state so I'm assuming all of these updates on the UI thread are being requested too often for it to be able to process them all as well as user input.So I'm looking for a better solution and have come up with the following:When the background thread raises these progress updated events, instead of them being added to the listview instantly I add them to a Queue(Of String). Then every second the form would check this queue and remove any items currently in it and add them to the listview - using a Queue(Of T) instead of a List(Of T) should guarantee they come out in the correct order. Both of these operations (adding to the queue and reading/removing from it) would be done under a SyncLock block that would lock on the same object to avoid both threads trying to work with the queue at the same time, so there would still be some contention but I'm hoping it would mean the UI thread only gets busy once a second instead of potentially roughly 30 times a second as it is doing now.Does that sound like a good plan? Can anyone think of a better way of handling this?

View 18 Replies







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