Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15605

passing values between sub

$
0
0
hi to everybody..
i' have a program which analyze group rail reservations.
downloading a json i analyze this reservation (date,time,departure,car etc) and to retrieve data to print them,to make label visibile i used a lot of global variables.
i'm sure this won't be the right way,but a function returns only ONE value.
for instance loading a train reservation i need to have access to date,departure,total passenger loading.etc so i can use those values to fill label,listbox (other sub),combobox (other sub) and print them
which is the best way ? a module with all subs ??


Code:



        'i count passengers boarding and unloading in each city choosen from combobox1 
                paxinsalita1 = treno1.AsEnumerable().Count(Function(row) (row.Field(Of String)("Departure") = ComboBox1.SelectedValue))
                paxindiscesa1 = treno1.AsEnumerable().Count(Function(row) (row.Field(Of String)("Arrival") = ComboBox1.SelectedValue))


                'list of all destinations from the city choosen from combobox1
                Dim destinazione = From n In treno1.AsEnumerable()
                                                  Where n.Field(Of String)("Departure") = ComboBox1.SelectedValue
                                                  Select n.Field(Of String)("Arrival")

                'list of all cars booked from the city of combobox1
                Dim carrozze = From n In treno1.AsEnumerable()
                                          Where n.Field(Of String)("Departure")= ComboBox1.SelectedValue
                                          Select n.Field(Of String)("Arrival")

                'elimino i duplicati e creo una list
                Dim elencocarrozze = (carrozze.Distinct).ToList

                Dim destinazioni = (destinazione.Distinct).ToList


                End Sub

now i need to use carrozze,destinazione,paxinsalita,paxinsalita1 in other parts of my program....how can i store them o retrieve them ?
i know this is the basic of programming but,now,i 'm here to ask just help and what to study.
thanks

Viewing all articles
Browse latest Browse all 15605

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>