Other facets of the Client/Server problem

P

pamelafluente

I am exploring also the Smart Client approach for my Client/server
problems.
I have written this (CLIENT SIDE)

'--------------------------
Public Class Form1

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

'Here I call a remote method from my client application

Dim ServerURL As String = "http://YourUrl/Server.exe"

Try
Dim Assembly As System.Reflection.Assembly =
System.Reflection.Assembly.LoadFrom(ServerURL)

'first call
Dim NameRemoteClass1 As String = "Server.Form1"
Dim Type1 As Type = Assembly.GetType(NameRemoteClass1)
Dim MyRemoteClass1 As Form =
DirectCast(Activator.CreateInstance(Type1), Form)
MyRemoteClass1.Show()
Type1.GetMethod("DrawSomething").Invoke(MyRemoteClass1,
Nothing)

'second call (parameterized)
Dim NameRemoteClass2 As String = "Server.MyRemoteClass"
Dim Type2 As Type = Assembly.GetType(NameRemoteClass2)
Dim MyRemoteClass2 As Object =
Activator.CreateInstance(Type2)
Type2.GetMethod("SayThis").Invoke(MyRemoteClass2, New
Object() {"Hello group"})

Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

End Class
'--------------------------

and on the server I have put this (SERVER.EXE):

'--------------------------
Public Class Form1

Sub DrawSomething()
Dim g As Graphics = Me.CreateGraphics
g.FillEllipse(Brushes.Blue, _
New Rectangle(10, 10, 200, 100))
End Sub

End Class

Public Class MyRemoteClass

Sub SayThis(ByVal ThingToSay As String)
MsgBox(ThingToSay)
End Sub

End Class
'--------------------------

This works fine. My questions:

- Can I get a similar result having the form running within a Web page?
(like an applet?)
- Also is there a wat to remove the security warning?
- How do I taljk back to my server program ?

-Pam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top