Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
VB
    Private Sub f_OnRoomMessage(ByVal MyFrbSocket As frbclient, ByVal RoomName As String, ByVal Id As String, ByVal Message As String) Handles f.OnRoomMessage
        On Error Resume Next

        If Id = msterid.Text Or Id = "mind,hunter" Or Id = master2.Text Or Id = master3.Text Then
            If Message = "bot/on" Or Message = "Bot/on" Then
                f.WriteRoomMessage(room.Text, "I'm Ready ;)")
                CheckBox1.Checked = True
            End If
            If Message = "Bot/off" Or Message = "bot/off" Then
                f.WriteRoomMessage(room.Text, "Time To Sleep (a)")
                CheckBox1.Checked = False
            End If
            If Message.ToUpper = "SHOW/MSG" Then
                For x As Integer = 0 To xxx.Items.Count - 1
                    f.WriteRoomMessage(room.Text, xxx.Items(x) & vbCrLf)
                Next
            End If
            If InStr(1, Message, "DEL#", vbTextCompare) <> 0 Then
                Dim addd As String
                If InStr(1, Message, "#", vbTextCompare) <> 0 Then
                    addd = Mid(Message, InStr(Message, "#") + 1)
                    For x As Integer = 0 To xxx.Items.Count - 1
                        If addd = xxx.Items(x) Then
                            xxx.Items.RemoveAt(x)
                            f.WriteRoomMessage(room.Text, "Removed :D")
                            Exit For
                        End If
                    Next
                End If
            End If

            If InStr(1, Message, "ADD#", vbTextCompare) <> 0 Then
                Dim add As String
                If InStr(1, Message, "#", vbTextCompare) <> 0 Then
                    add = Mid(Message, InStr(Message, "#") + 1)
                    checking(add)
        End If
        End If
        End If
        If CheckBox1.Checked = True Then
            For i As Integer = 0 To xxx.Items.Count - 1
                Dim reply As String
                Dim emo As String
                If InStr(1, xxx.Items.Item(i), "/", vbTextCompare) <> 0 Then
                    reply = Mid(xxx.Items.Item(i), InStr(xxx.Items.Item(i), "/") + 1)
                    emo = LCase(Microsoft.VisualBasic.Left(xxx.Items.Item(i), InStr(xxx.Items.Item(i), "/") - 1))
                    If emo.ToUpper = Message.ToUpper Then
                        f.WriteRoomMessage(room.Text, reply)
                    End If
                End If
            Next
        End If
    End Sub
    Private Sub checking(add)
        Dim emox As String
        Dim addx As String
        For x As Integer = 0 To xxx.Items.Count - 1
            'here i want to match if addx is and emox is same then "ADD" should not added to listbox xxx
            'error is here with this "ADD" is add many time in xxx.items(x) and addx and emox did not match 
            addx = LCase(Microsoft.VisualBasic.Left(add, InStr(add, "/") - 1))
            emox = LCase(Microsoft.VisualBasic.Left(xxx.Items(x).ToString, InStr(xxx.Items(x).ToString, "/") - 1))
'this function is not working w
            If emox.ToString.ToUpper = addx.ToUpper Then

                f.WriteRoomMessage(room.Text, "Paa Ji This " + addx + " Is Already Exist :D ")

                Exit For
            Else
                xxx.Items.Add(add)
                f.WriteRoomMessage(room.Text, "Added ;)")
            End If
        Next
        'This Way It Read and match only last added item 
        '   Dim emox As String
        '   Dim addx As String
        '  For i = 0 To xxx.Items.Count - 1
        '   Dim i As Integer = (xxx.Items.Count - 1)
        '  addx = LCase(Microsoft.VisualBasic.Left(add, InStr(add, "/") - 1))
        '  emox = LCase(Microsoft.VisualBasic.Left(xxx.Items(i), InStr(xxx.Items(i), "/") - 1))
        '
        '  If addx.ToUpper = emox.ToUpper Then
        'f.WritePrivateMessage(Id & "@nimbuzz.com", "Paa Ji This " + addx + " Is Already Exist :D ")
        '   Else
        '    xxx.Items.Add(add)
        '   End If
    End Sub
Posted
Updated 4-Oct-13 5:13am
v2
Comments
TrushnaK 4-Oct-13 8:08am    
what is your question?
abbaskhanx 4-Oct-13 8:13am    
i want to know here is my mistake in codes
abbaskhanx 4-Oct-13 8:14am    
For x As Integer = 0 To xxx.Items.Count - 1
'error is here but i can not understand it
addx = LCase(Microsoft.VisualBasic.Left(add, InStr(add, "/") - 1))
emox = LCase(Microsoft.VisualBasic.Left(listbox1.Items(x), InStr(listbox1.Items(x), "/") - 1))
If addx.ToUpper <> emox.ToUpper Then
xxx.Items.Add(add)


Else
in this part there is some error
Thomas ktg 4-Oct-13 8:16am    
Post the error you are getting.
abbaskhanx 4-Oct-13 9:56am    
:D there is no error i get
addx and emox funtion that is added its not working sir

1 solution

Um.
Look above that:
VB
Private Sub f_OnRoomMessage(Message)

        'Message is like add#hiii/helo
        If InStr(1, Message, "ADD#", vbTextCompare) <> 0 Then
            Dim add As String
            If InStr(1, Message, "#", vbTextCompare) <> 0 Then
                add = Mid(Message, InStr(Message, "#") + 1)
                checking(add)


    End If
    End If
    End If
Shouldn't that last one be "End Sub"? :laugh:
 
Share this answer
 
Comments
abbaskhanx 4-Oct-13 8:27am    
bro i know that and i write half of these code but error is not in this part see in comments
For x As Integer = 0 To xxx.Items.Count - 1
'error is here but i can not understand it
addx = LCase(Microsoft.VisualBasic.Left(add, InStr(add, "/") - 1))
emox = LCase(Microsoft.VisualBasic.Left(listbox1.Items(x), InStr(listbox1.Items(x), "/") - 1))
If addx.ToUpper <> emox.ToUpper Then
xxx.Items.Add(add)


Else
'do nothing
Exit For
OriginalGriff 4-Oct-13 8:43am    
Yes - but if you fix that, the later "errors" may well disappear...
abbaskhanx 4-Oct-13 9:04am    
if addx and emox is same then ADD should not be added in xxx.items list
OriginalGriff 4-Oct-13 9:28am    
So: what is in the two variables?
Have you used the debugger to look at them?
abbaskhanx 4-Oct-13 9:34am    
addx is like "hi/hello"
and emox should match left side of "/" in listbox
if "hi" is already in listbox items then "add" should not added

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900