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.


.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
Fernando Soto

8/22/2022 - Mon
Fernando Soto

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
ASKER
JamesBrian

\Implementation\Server\LineItems.vb(1): class 'GridLineItems' and class 'GridLineItems', declared in \Client\LineItems.vb', conflict in namespace '<Default>'.
ASKER
JamesBrian

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>'.
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER CERTIFIED SOLUTION
Fernando Soto

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question