Please, give me a head start :/ i really don't know where to start from here.
I am now a frequent user of VB.NET 2010 and now I encountered another hurdle,
my first project (Electronic Smart Card Attendance System) was successful but
now i want to experiment more on server-client vb programming.
How do I throw a VB.NET command from a server form
to client form remotely..? for example:
When I click "show button click event" on the form from server computer,
it will show the form / results that I wanted to show on the client's computer / VB.NET GUI.
I just want to know the syntax/code blocks that I may use.
I'm sorry if I sound a bit bossy but it's kinda frustrating X(
Help will be greatly appreciated <3
Check these out:
[VB.Net] Multi-Client Server Async Socket Example
[Tutorial][VB.Net] Asynchronized Server/Client Demo(using sockets)
Related
I am new to visual basic 6 and I would like to write a code that can detect if serial port com1 is connected then the application will automatically close.
Thanks and appreciated your help!
First of all, like it's already said in the comments, you surely mean VB6 and not VBA.
Without any code it's difficult to give you a good answer. But I will try..
There is a MSComm Control in VB6 which is useful for serial communication. You can check the property 'PortOpen'
MSComm1.CommPort = 1
If MSComm1.PortOpen = False Then
Unload Me
End If
For further information check this question:
Problems opening and closing the mscomm port in vb6 when interfacing microcontroller
and see this documentation:
https://msdn.microsoft.com/en-us/library/aa259393(v=vs.60).aspx
How can I communicate between VB.net and GlovePIE?
I know that you can send OSC (Open Sound Control-It isn't just for sound) data in GlovePIE so if you could send/receive data in VB.net without any libraries that would work but I cannot find any resources.
Please post any code that you can.
EDIT: All I want is a basic way to communicate between GlovePIE and VB.net and I found that you could send OSC data in GlovePIE but you cannot in VB.net I would accept any help that I can get. If you have a better method, feel free to tell me. I am using this guide to send the data.
After lots of creative thinking, and hours wasted, I finally came up with an idea. (Thanks to spajce for helping me realize there is no perfect solution, and I had to think outside of the box to make this work.) This is what I am going to do. (I have not written the code yet, but I will try to submit it as soon as I write it.)
How I am going to set it up:
I will have a form in VB.net that will send data to the COM port. It's GUI will have the user select the COM port and have a button to connect.
In my GlovePIE script, I will have it automatically hide itself.
For data transfer to VB.net:
GlovePIE will tell if the form is selected using the Window.Title property. If it is, it will emulate a key press. The form will be looking for the keypress.
For Data Transfer to GlovePIE:
The form will change the Me.text property to something that has happened. For exaple, I'm building a robot and if the ping sensor senses something, my Aduino will send the data over serial, to VB.net, which will change the title to "Robot Connect-OBJECT DETECTED" GlovePIE will know the multiple names the form might be, and when searching to see if it is active, it can tell if something has been detected. VB.net will change the title back to "Robot Connect" after GlovePIE signals it has recived the signal.
There will be some bugs, but VB.net is smart enough to tell if another window is the active one. If you are browsing this question, you may have to adapt this. I will have to put a couple of safety features to prevent the robot from not stopping when the VB.net window loses focus.
Thanks to anbody who tried to help.
I've been developing a .net application for the company I work for, there is just one part I can't seem to do. I need to send a string to a textbox of another program and then copy the result. The result is shown in a label. Currently we hand type the string and manually copy the label text, so I know the information can be copied I just don't know how to do it via code.
The application I need to send the text too is also written with the .net framework if that helps.
Any answers are appreciated :)
Cheers.
You can use native SendMessage() from user32.dll. If you dont know how to import a dll command,
see Platform Invoke Tutorial from MSDN. Once you know how to import a dll command, use FindWindow() to find the window handle of your application and send the string using SendMessage().
The other alternatives is to use socket. Send the message via local network (localhost).
Here's a small tutorial about Socket. Hope this helps :)
I want to do what I have done in the past, using the old VB6. Subclassing has changed a lot since VB6 and I still want to do the same:
I need to intercept WM_PAINT of DataGridView, send it to a memory device context (to avoid flickering), make some visual changes, like place a logo over all over the grid. With VB6, was easy to do. I have spend hours trying to convert VB6/API code to Visual Basic Express 2010 code, without success.
So, if anybody know how to do it ... let me know please.
Thank's on advance
AbĂlio Rodrigues
You can't send messages to device contexts, only to windows. Get the handle of the window for the control, and send the message there.
We have an unattended app w/o a user interface that is is periodically run.
It is a VB.NET app. Instead of it being developed as a service, or a formless Windows application, it was developed with a form and all the code was placed in the form_load logic, with an "END" statement as the last line of code to terminate the program.
Other than producing a program that uses unneeded Windows form resources, is there a compelling reason to send this code back for rework to be changed to put the start up logic in a MAIN sub of a BAS file?
If the program is to enter and exit the mix (as opposed to running continuously) is there any point in making it a service?
If the app is developed with a Form do I have to worry about a dialog box being presented that no one will respond to even if there are no MessageBox commands in the app?
I recall there used to be something in VB6 where you could check an app as running unattended, presumably to avoid dialogs.
I don't know whether there are conditions where this will not run.
However, if the code was delivered by someone you will work with going forward, I would look at this as an opportunity to help them understand best practices (which this is not), and to help them understand that you expect best-practice code to be delivered.
First of all, you don't need it to be run in a Form.
Forms are there for Presentation, so it should not be done there.
If you don't want to mess with converting the application a Service (not difficult, but not very easy neither), you shoud create a Console Application, and then, schedule it with Windows Task Scheduler.
This way, you create a Console Application, with a Main function, that does exactly what you need.
Anyway, the programmer could show windows, so there should not be any messagebox. Any communication should be done via Logging to: local files, windows events, database.
If you want more information on any of them, ask me.
If you don't want it to be a service, nothing says that it has to be a windows service. Scheduling it to run via the Task Scheduler or something similar is a valid option.
However, it does sound like the developer should have choose a "Console App" project, instead of a "Windows Forms" project to create this app.
Send it back. The application is bulkier and slower than it needs to be, although that won't be much of an issue. It is somewhat more likely to run out of resources. But the main reason: converting it to a console app is very easy.
If you don't prefer for the Console window to popup, simply do the following.
Create a new class "Program.vb", add a public shared Main() method, and move the "OnLoad" logic from the form to this method.
Next delete the form, and change the project start up object (Available in the project properties window) to use the Program.Main instead of the Form.
This will have the same effect, without the windows forms resources being used. You can then remove the references to System.Windows.Form and System.Drawing.