Hello everyone, what i'm doing now, it's read info from CANBUS and put it in the listbox in vb6. It looks likeSO what i have in listbox after a get it itsCode:tmp = idtag.Text & vbTab & dlc.Text & vbTab & RxData.Text
so as you can see i have two id 140, so it means listbox just add new line every time. What i want it's make it read ID then if its equal to id that we receive from CANBUS, we put data exactly to that ID. Like "if ID from CANBUS = ID in LISTBOX then update data from CANBUS in that ID, if received id doesnt excist in listbox, then add new item". As you can see from a picture i recevie data from canbus in one like, ID+DLC+DATA like this "0000014008BBBBBBBBBBBBBBBB" then i extract right values from with MID() then add to listbox. My code is:
Any ideas? aprecciate any input. ThanksCode:Select Case MSComm1.CommEvent Case comEvReceive Buffer = MSComm1.Input Text1.Text = Text1.Text & Buffer If Len(Text1.Text) = 26 Then Text4 = Text1 idtag.Text = Mid(Text1.Text, 6, 3) dlc.Text = Mid(Text1.Text, 10, 1) RxData.Text = Mid(Text1.Text, 11, 16) 'Call Command1_Click RxData.Text = Right(Text1.Text, Val(dlc.Text * 2)) RxData = SpaceIt(RxData) tmp = idtag.Text & vbTab & dlc.Text & vbTab & RxData.Text If List1.ListCount > 14 Then List1.RemoveItem (a) List1.AddItem tmp, a Text1.Text = "" a = a + 1 If a > 14 Then 'List1.Clear a = 0 End If End If End Select End Sub




Reply With Quote
