home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,336 of 10,840   
   J French to invalid@invalid.invalid   
   Re: Mid function   
   30 Dec 06 11:25:31   
   
   From: erewhon@nowhere.uk   
      
   On Sat, 30 Dec 2006 12:19:20 +0100, "313 Games"   
    wrote:   
      
   >hi,   
   >   
   >ive got a question. im making an chat program with server and client using   
   >vb 6. but now my problem is, i want to set a topic in each server.   
   >   
   >i want to send the data from the server to all the clients connected, and   
   >the client can see: ow, a topic, then /topic Bla bla bla   
      
   >This is my code, maybe its less complicated.   
   >   
   >    Dim Data As String   
   >    Sock.GetData (Data)   
   >   
   >    If Mid(Data, 0, 6) = "/topic" Then   
   >        lblTopic.Caption = Mid(Data, 7)   
   >        Exit Sub   
   >    End If   
   >   
   >    List1.AddItem (Data)   
   >   
   >help is appreciated.   
      
      Mid(Data, 1, 6) = "/topic"   
      
   0 instead of 1 will throw an error   
      
   Personally I would use  Left( Data, 6) = "/topic"   
      
   Incidentally  Mid$( Data, 1, 6 ) and Left$(Data, 6)  are faster, the $   
   returns a string while without the $ you get a string in a variant.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca