Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

Winsock Array problem

[es] :: .NET :: .NET Desktop razvoj :: Winsock Array problem

[ Pregleda: 1603 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

Blue82
dipl. ecc.

Član broj: 165981
Poruke: 838
*.adsl-3.sezampro.rs.



+322 Profil

icon Winsock Array problem09.10.2011. u 11:10 - pre 152 meseci
Nikako da skontam kako se pravi jednostavan niz u VB.NET-u.

Pronasao sam jedan zgodan primer za Winsock kontrolu (zgodan zato sto je kratak :) ) ali i dalje imam problem.

Code:

Dim MySocketArray As New ArrayList
Dim MySocketControl As SocketControl 'Lets say it is called just like that for this example

'Adds the first one to the collection
MySocketControl = New SocketControl
MySocketArray.Add(MySocketControl)

'Adds the second one to the collection
MySocketControl = New SocketControl
MySocketArray.Add(MySocketControl)

'To Read the first item back to SocketControl type again
MySocketControl = CType(MySocketArray(0), SocketControl)

'To go through the entire collection to find a particular Socket Control

For Each TempSocketControl As SocketControl In MySocketArray
      'Do your code in here
Next


Da li je potrebno uvesti neku referencu za SocketControl jer on ne prepoznaje taj tip?
 
Odgovor na temu

Shadowed
Vojvodina

Član broj: 649
Poruke: 12851



+4784 Profil

icon Re: Winsock Array problem09.10.2011. u 13:19 - pre 152 meseci
Bolje koristi List(of SocketControl).
 
Odgovor na temu

Blue82
dipl. ecc.

Član broj: 165981
Poruke: 838
*.adsl-3.sezampro.rs.



+322 Profil

icon Re: Winsock Array problem09.10.2011. u 13:43 - pre 152 meseci
Imas neki blic primer?
 
Odgovor na temu

Shadowed
Vojvodina

Član broj: 649
Poruke: 12851



+4784 Profil

icon Re: Winsock Array problem09.10.2011. u 15:54 - pre 152 meseci
Pa, isto je. Dodajes sa Add a dobijas navodeci index ili sa for each. Samo sto neces imati konverzije tipova.
Kada koristis ArrayList, svi elementi su tipa Object pa moras da kastujes, ovako imas upravo tip koji si naveo u deklaraciji liste.
 
Odgovor na temu

Blue82
dipl. ecc.

Član broj: 165981
Poruke: 838
*.adsl-3.sezampro.rs.



+322 Profil

icon Re: Winsock Array problem09.10.2011. u 16:28 - pre 152 meseci
Dzaba kad to nisam nikad koristio. Hajde prepravi mi onaj gore primer.
Code:

Dim list As New List(Of MSWinsockLib)
        list.Add(2)

Sta staviti umesto ovoga MSWinsockLib? Nemam ideju.

I kada dodam sa .add kako ce mi onda posle glasiti npr linija

Code:

    Private Sub AxWinsock1_DataArrival(ByVal sender As Object, ByVal e As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles AxWinsock1.DataArrival

    End Sub


[Ovu poruku je menjao Blue82 dana 09.10.2011. u 17:38 GMT+1]
 
Odgovor na temu

[es] :: .NET :: .NET Desktop razvoj :: Winsock Array problem

[ Pregleda: 1603 | Odgovora: 4 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.