Solved

Providing a running total on all machines

Posted on 2000-02-28
6
128 Views
Last Modified: 2010-05-02
I've got 10 PC on a LAN that do wordprocessing in a VB program I wrote.
For reasons I can't go into there must be a running total of the amount of ENTER keystrokes displayed in a Label Control on all of the machines.
Eg. : PC1 presses ENTER - on all of the machines the running total goes up by one. Obviuosly the running total on all the machine must be the same.
How do I accomplish this?
0
Comment
Question by:Heinrichsa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 2564111
You could simply send out a UDP message when the enter key is pressed to all the machines on a specific port to tell them to increment there counter/or just tell them the complete new value that way they will always match.
0
 
LVL 13

Accepted Solution

by:
crazyman earned 200 total points
ID: 2564126
Something like this...

where text1 is the box for trapping key press and lblreturnpresses is the label.



Option Explicit

Private Sub Form_Load()
    Winsock1.Protocol = sckUDPProtocol
    Winsock1.Bind 12345
    lblreturnpresses.Caption = 0
End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 13 Then
        With Winsock1
            .RemotePort = 12345
            .RemoteHost = "255.255.255.255"
            .SendData CStr(CInt(lblreturnpresses) + 1)
        End With
    End If
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
    Dim strData As String
    Winsock1.GetData strData
    lblreturnpresses = strData
End Sub
0
 
LVL 1

Expert Comment

by:rskathait
ID: 2564486
Can you tell me what is your application architecture.....
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 2

Expert Comment

by:danlevans
ID: 2566478
Heinrichsa,

Bind all of your applications to a control database table. Update a count field each time the enter key is pressed. Display the count field on all PC's refreshing it with the timer.

Have Fun

Dan

0
 

Author Comment

by:Heinrichsa
ID: 2567740
danlevans,

I would not like to use a database because of the recordlocking that occurs. I know I can use the batch updating of ADO, but even with that it is not so effiecient with high hit rate.

I think crazyman has hit the nail on the head thanks for everyones comments
0
 
LVL 13

Expert Comment

by:crazyman
ID: 2576882
Thanks for the points,glad i could help
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question