Click here to Skip to main content
15,918,889 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Interop Questions Pin
freakyit20-Oct-09 1:35
freakyit20-Oct-09 1:35 
AnswerRe: Interop Questions Pin
Richard MacCutchan20-Oct-09 1:36
mveRichard MacCutchan20-Oct-09 1:36 
QuestionOracle 10 g user id passwords Pin
manish.m.meshram19-Oct-09 18:30
manish.m.meshram19-Oct-09 18:30 
QuestionHow to get Default Mail Application name? (like microsoft office outlook) Pin
CeremBeyazit19-Oct-09 12:39
CeremBeyazit19-Oct-09 12:39 
AnswerRe: How to get Default Mail Application name? (like microsoft office outlook) Pin
N a v a n e e t h19-Oct-09 16:40
N a v a n e e t h19-Oct-09 16:40 
QuestionUnusual Problem: Listbox Not Updating Pin
raineym19-Oct-09 7:50
raineym19-Oct-09 7:50 
AnswerRe: Unusual Problem: Listbox Not Updating Pin
Luc Pattyn19-Oct-09 7:57
sitebuilderLuc Pattyn19-Oct-09 7:57 
GeneralRe: Unusual Problem: Listbox Not Updating [modified] Pin
raineym19-Oct-09 8:52
raineym19-Oct-09 8:52 
OK, I'll take the link to the code down. Stupid, I know, but I can't seem to figure this out.

The form is still active and still responds to other events. All the other commands of all the other events work with no problem, except when it comes to the listbox, then the execution of the rest of the code in the function ceases.

Here is the code for the sub that just stops when it gets to the clearing out of the listbox items in the USERS part of the Select Case statement. This sub is in a module. I get the same result whether I reference the listbox with "frmServerConnect.lstUsersOnline" or "Public whatever As ListBox = frmServerConnect.lstUsersOnline".

Public Sub ReceiveMessage(ByVal ar As IAsyncResult)
    Try
      Dim bytesRead As Integer
      bytesRead = client.GetStream.EndRead(ar)
      If bytesRead < 1 Then
        Exit Sub
      Else
        Dim messageReceived As String = System.Text.Encoding.ASCII.GetString(data, 0, bytesRead)
        Dim myRegex As New Regex("\[(JOIN|LEAVE|USERS|ROLL)\](\[([^\]]+)\])?(\[([^\]]+)\])?")
        If myRegex.IsMatch(messageReceived) Then
          Dim myMatch As Match = myRegex.Match(messageReceived)
          Select Case myMatch.Groups.Item(1).ToString
            Case "JOIN" '==== [JOIN][Nick][Role] ====
              frmServerConnect.lstUsersOnline.Items.Add(String.Format("{0} ({1})", myMatch.Groups.Item(3).ToString, myMatch.Groups.Item(5).ToString))
            Case "LEAVE" '==== [LEAVE][User] ===
              Try
                'frmServerConnect.lstUsersOnline.Items.RemoveAt(frmServerConnect.lstUsersOnline.Items.IndexOf(myMatch.Groups.Item(3).ToString))
              Catch ex As Exception
              End Try
              Exit Select
            Case "USERS" '=== [USERS][User1Name|User1Role;User2Name|User2Role,etc] ===
              Dim usr() As String = myMatch.Groups.Item(3).ToString.Split(";")
              frmServerConnect.lstUsersOnline.Items.Clear()
              For Each u As String In usr
                Dim x() As String = u.Split("|")
                frmServerConnect.lstUsersOnline.Items.Add(String.Format("{0} ({1})", x(0), x(1)))
              Next
            Case "ROLL"
              'txtMessageHistory.AppendText(myMatch.Groups.Item(5).ToString)
              Exit Select
            Case Else
              Exit Sub
          End Select
        End If
      End If

      '---continue reading for more data
      client.GetStream.BeginRead(data, 0, CInt(client.ReceiveBufferSize), AddressOf ReceiveMessage, Nothing)
    Catch ex As Exception
      ' MsgBox(ex.ToString)
    End Try
  End Sub


Mike Rainey
--------------------------------

modified on Monday, October 19, 2009 2:58 PM

GeneralRe: Unusual Problem: Listbox Not Updating Pin
Luc Pattyn19-Oct-09 9:11
sitebuilderLuc Pattyn19-Oct-09 9:11 
GeneralRe: Unusual Problem: Listbox Not Updating Pin
raineym19-Oct-09 10:34
raineym19-Oct-09 10:34 
GeneralRe: Unusual Problem: Listbox Not Updating Pin
Luc Pattyn19-Oct-09 10:38
sitebuilderLuc Pattyn19-Oct-09 10:38 
NewsVisual Studio Beta 2 Available This Week, VS 2010 Launch Date Announced, New Packaging Revealed Pin
brucedkyle19-Oct-09 6:24
brucedkyle19-Oct-09 6:24 
QuestionCapture Screenshot of a Window(With Handle) Pin
Harrison Jones19-Oct-09 6:17
Harrison Jones19-Oct-09 6:17 
AnswerRe: Capture Screenshot of a Window(With Handle) Pin
Richard MacCutchan19-Oct-09 10:14
mveRichard MacCutchan19-Oct-09 10:14 
AnswerRe: Capture Screenshot of a Window(With Handle) Pin
Mark Salsbery19-Oct-09 11:19
Mark Salsbery19-Oct-09 11:19 
AnswerRe: Capture Screenshot of a Window(With Handle) Pin
freakyit20-Oct-09 1:44
freakyit20-Oct-09 1:44 
GeneralRe: Capture Screenshot of a Window(With Handle) Pin
dxlee20-Oct-09 7:11
dxlee20-Oct-09 7:11 
GeneralRe: Capture Screenshot of a Window(With Handle) Pin
dxlee20-Oct-09 7:13
dxlee20-Oct-09 7:13 
GeneralRe: Capture Screenshot of a Window(With Handle) Pin
freakyit27-Oct-09 2:49
freakyit27-Oct-09 2:49 
GeneralRe: Capture Screenshot of a Window(With Handle) Pin
dxlee27-Oct-09 3:52
dxlee27-Oct-09 3:52 
GeneralGuidance for writing a wrapper for a REST API Pin
Brady Kelly19-Oct-09 6:11
Brady Kelly19-Oct-09 6:11 
QuestionAccessing the machine.config file Pin
Przemyslaw Celej19-Oct-09 2:28
Przemyslaw Celej19-Oct-09 2:28 
AnswerRe: Accessing the machine.config file Pin
Not Active19-Oct-09 3:32
mentorNot Active19-Oct-09 3:32 
GeneralRe: Accessing the machine.config file Pin
Przemyslaw Celej19-Oct-09 4:28
Przemyslaw Celej19-Oct-09 4:28 
GeneralRe: Accessing the machine.config file Pin
Not Active19-Oct-09 4:47
mentorNot Active19-Oct-09 4:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.