Click here to Skip to main content
15,914,222 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHelp... Again... Pin
Member 1072866720-Apr-14 6:42
Member 1072866720-Apr-14 6:42 
AnswerRe: Help... Again... Pin
Member 1072866720-Apr-14 6:44
Member 1072866720-Apr-14 6:44 
GeneralRe: Help... Again... Pin
Wes Aday20-Apr-14 7:03
professionalWes Aday20-Apr-14 7:03 
GeneralRe: Help... Again... Pin
Member 1072866720-Apr-14 8:13
Member 1072866720-Apr-14 8:13 
GeneralRe: Help... Again... Pin
Wes Aday20-Apr-14 8:36
professionalWes Aday20-Apr-14 8:36 
GeneralRe: Help... Again... Pin
Tino Fourie24-Apr-14 7:00
Tino Fourie24-Apr-14 7:00 
QuestionAbout handling MSComm events in VB6 Pin
Member 1056890820-Apr-14 5:20
Member 1056890820-Apr-14 5:20 
AnswerRe: About handling MSComm events in VB6 Pin
Eddy Vluggen21-Apr-14 8:18
professionalEddy Vluggen21-Apr-14 8:18 
GeneralRe: About handling MSComm events in VB6 Pin
Member 1056890821-Apr-14 14:27
Member 1056890821-Apr-14 14:27 
GeneralRe: About handling MSComm events in VB6 Pin
Eddy Vluggen21-Apr-14 22:33
professionalEddy Vluggen21-Apr-14 22:33 
GeneralRe: About handling MSComm events in VB6 Pin
Nicholas Marty22-Apr-14 0:06
professionalNicholas Marty22-Apr-14 0:06 
GeneralRe: About handling MSComm events in VB6 Pin
Member 105689083-May-14 21:41
Member 105689083-May-14 21:41 
QuestionRounding To 2 Decimal Places Pin
Member 1072866719-Apr-14 16:46
Member 1072866719-Apr-14 16:46 
AnswerRe: Rounding To 2 Decimal Places Pin
Richard MacCutchan19-Apr-14 21:22
mveRichard MacCutchan19-Apr-14 21:22 
QuestionQueue and Stack Pin
DJHJr17-Apr-14 8:04
DJHJr17-Apr-14 8:04 
AnswerRe: Queue and Stack Pin
Eddy Vluggen17-Apr-14 8:31
professionalEddy Vluggen17-Apr-14 8:31 
GeneralRe: Queue and Stack Pin
DJHJr17-Apr-14 9:07
DJHJr17-Apr-14 9:07 
GeneralRe: Queue and Stack Pin
Eddy Vluggen17-Apr-14 10:24
professionalEddy Vluggen17-Apr-14 10:24 
Questionfilesystemwatcher possible infinite loop Pin
Tony Snowden17-Apr-14 0:20
Tony Snowden17-Apr-14 0:20 
AnswerRe: filesystemwatcher possible infinite loop Pin
Richard Andrew x6417-Apr-14 0:45
professionalRichard Andrew x6417-Apr-14 0:45 
GeneralRe: filesystemwatcher possible infinite loop Pin
Tony Snowden17-Apr-14 1:07
Tony Snowden17-Apr-14 1:07 
QuestionHow to Run Transparent Flash Files Over a Running Video in VB Pin
NAVEEN SONI16-Apr-14 17:56
NAVEEN SONI16-Apr-14 17:56 
QuestionPass a string to a control on a form from a remoting connection Pin
ParadoxLiving15-Apr-14 20:27
ParadoxLiving15-Apr-14 20:27 
AnswerRe: Pass a string to a control on a form from a remoting connection Pin
Alan N16-Apr-14 4:48
Alan N16-Apr-14 4:48 
GeneralRe: Pass a string to a control on a form from a remoting connection Pin
ParadoxLiving16-Apr-14 16:07
ParadoxLiving16-Apr-14 16:07 
Thank you so much for your reply. With some minor changes I got the code working. Here is the final result.

The MS ISharedInterface in a class library referenced by both the server and the client.
VB
Public Interface ISharedInterface
  Function HelloWorld(input As String) As String
End Interface

The message receiver in the windows forms project for the server
VB
Imports SharedInterface
Imports System.Windows.Forms
Public Class MessageReceiver
    Inherits MarshalByRefObject
    Implements ISharedInterface
    Private ReadOnly log As Textbox
    Private Delegate Sub Update(text As [String])

    Public Sub New(log As TextBox)
        Me.log = log
    End Sub

    ' ISharedInterface function
    Public Function HelloWorld(input As String) As String Implements ISharedInterface.HelloWorld
        log.Invoke(New Update(AddressOf UpdateTextBox), input)
        Return input
    End Function

    Private Sub UpdateTextBox(text As [String])
        log.AppendText(text)
        log.AppendText(Environment.NewLine)
    End Sub

    Public Overrides Function InitializeLifetimeService() As Object
        Return Nothing
    End Function
End Class


The Form for the Server i used was just the standard form. i added a textbox and made it multiline in the form designer. here is the code

VB
Imports System.Windows.Forms
Imports System.Runtime.Remoting.Channels.Ipc
Imports System.Runtime.Remoting.Channels
Imports System.Runtime.Remoting
Public Class Form1
    Private server As IpcServerChannel
    Private receiver As MessageReceiver
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ' create local object and give it the textbox reference
        receiver = New MessageReceiver(logTextBox)

        ' Create the server channel
        ' remote object name will be "ipc://IpcPortName/ServerObject.rem"
        Server = New IpcServerChannel("IpcPortName")
        ChannelServices.RegisterChannel(Server, False)
        logTextBox.AppendText("IpcServerChannel created")
        logTextBox.AppendText(Environment.NewLine)

        ' publish the local object
        RemotingServices.Marshal(receiver, "ServerObject.rem")
    End Sub

and finally the client in its own console application
VB
Imports SharedInterface
Imports System.Threading
Public NotInheritable Class ClientApp
    Private Sub New()
    End Sub

    Private Shared remoteObject As ISharedInterface

    Public Shared Sub Main(args As String())
        Try
            remoteObject = DirectCast(Activator.GetObject(GetType(ISharedInterface), "ipc://IpcPortName/ServerObject.rem"), ISharedInterface)
            For i As Int32 = 0 To 4
                Console.WriteLine("  " & remoteObject.HelloWorld("Hi Server " & i))
                Thread.Sleep(2000)
            Next
        Catch re As System.Runtime.Remoting.RemotingException
            Console.WriteLine(re)
        End Try
        Console.WriteLine("Press enter to end...")
        Console.ReadLine()
    End Sub
End Class

Again, Many thanks for the example you coverted, and the prompt reply.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.