Link to home
Start Free TrialLog in
Avatar of JamesBrian
JamesBrian

asked on

Client / Server question

HI all,

I'm fairly new at this, so bear with me if I am not coming across correctly.

I have an existing client/server applictaion.
On client side, I am selecting records from a datagrid.
The gridline(s) that are selected, are processed, and some columns end up in a custom type: GridLineItems
This class resides on the Client side (is this correct?)

This type has some properties :
-      FileLine as string
-      FileNaam as string
-      VerstuurCode as string
and so on

I use an arraylist to store my GridLineItems.
'declarations :
                  Dim arrline As GridLineItems
            Lines = New ArrayList

' Button Event:
For x = 0 To nbrRows - 1
                currID = Convert.ToString(grdSendFromFile.Item(tel, 0))
                Dim newID As String = Format_ID(currID)
                Dim soort As String = Convert.ToString(grdSendFromFile.Item(tel, 6))
                Dim verstuurCode As String = Convert.ToString(grdSendFromFile.Item(tel, 8))
                Dim verzendDatum As String = Convert.ToString(grdSendFromFile.Item(tel, 10))

                arrline = New GridLineItems
                arrline.FileLine = PrePareLine(newID, soort, verstuurCode)
                arrline.FileNaam = newID
                arrline.VerstuurCode = verstuurCode
                arrline.VerzendDatum = verzendDatum
                arrline.Soort = soort
                Lines.Add(arrline)
            Next

So far, so good.I now have an arraylist of GridLineItems objects.

The (for me) tricky part is to 'send' my ArrayList (Lines) to the serverside.
           
                  CallToServer = ApplicationContext.WsDMFATool.testme(Lines)

-------SERVER SIDE-------

Public Function testme(ByVal arr As ArrayList) As Boolean

            Dim returnValue As Boolean = Nothing
            Dim arrline As GridLineItems
            Dim tw As StreamWriter
            Try
                        For Each arrline In Lines
                              currID =
                              tw.WriteLine(arrline.FileLine) ' create textfile
                        Next

                Return True
            Catch ex As Exception

            End Try

        End Function

---------------------------

But of course, the type GridLineItems is unknown on Server Side

How do I get this to work?
Am I doing something fundamentally wrong?
Am I not declaring something I should?

Any help is appreciated.


Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi JamesBrian;

The custom type: GridLineItems that is defined on the client side must be declared on the server side as well, the same exact way, otherwise the server does not know what is being passed to it.

Fernando
Avatar of JamesBrian
JamesBrian

ASKER

\Implementation\Server\LineItems.vb(1): class 'GridLineItems' and class 'GridLineItems', declared in \Client\LineItems.vb', conflict in namespace '<Default>'.
I had tried that, but I get a warning :
\Implementation\Server\LineItems.vb(1): class 'GridLineItems' and class 'GridLineItems', declared in \Client\LineItems.vb', conflict in namespace '<Default>'.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial