Vraag & Antwoord

Programmeren

van txt naar lst

1 antwoord
  • ik heb dit als voorbeeld: [code:1:1aebf7744e]'Declarations Public Const EM_EMPTYUNDOBUFFER = 205 Public Const EM_CANUNDO = 198 Public Const EM_GETMODIFY = 184 Public Const EM_SETMODIFY = 185 Public Const EM_UNDO = 199 Public Const EM_CANPASTE = 1074 Public Const EM_FINDTEXT = 1080 Public Const EM_GETFIRSTVISIBLELINE = 206 Public Const EM_GETLINECOUNT = 186 Public Const EM_GETLINE = 196 Public Const EM_LINEFROMCHAR = 201 Public Const EM_LINEINDEX = 187 Public Const EM_LINELENGTH = 193 Public Const EM_EXLINEFROMCHAR = 1078 Public Const EM_LINESCROLL = 182 Public Const EM_SCROLLCARET = 183 Public Const EM_SETTABSTOPS = 203 Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lparam As Long) As Long 'Code Dim sFileName As String Dim Lines Dim WinH As Long Dim i As Integer Dim LineLength As Long Dim charOffset As Long 'Get the windows handle of the multiline text box WinH = txtFileName.hWnd 'Get the number of lines in the mutiline text box called txtFileName Lines = SendMessage(WinH, EM_GETLINECOUNT, 0, 0) For i = 0 To Lines - 1 'Retrieve the offset of first character in the line charOffset = SendMessage(WinH, EM_LINEINDEX, i, 0) 'Now get the length of the line LineLength = SendMessage(WinH, EM_LINELENGTH, charOffset, 0) 'Debug.Print LineLength sFileName = Mid$(txtFileName.Text, charOffset + 1, LineLength) Debug.Print sFileName Next i [/code:1:1aebf7744e] dit is de code die ik werkend wil hebben: [code:1:1aebf7744e]Public Sub ReadNames() 'On Error Resume Next 'Dim RmName As String Dim sFileName As String Dim Lines Dim WinH As Long Dim i As Integer Dim LineLength As Long Dim charOffset As Long 'Dim tmpdata5 'Dim tmpdata1 'Dim sfile2 As String 'Dim sfile3 As String 'RmName = txtRoomName.Text 'RmName = Right(RmName, Len(RmName) - 1) 'Get the windows handle of the multiline text box WinH = txtNames.hWnd 'Get the number of lines in the mutiline text box called txtNames Lines = SendMessage(WinH, EM_GETLINECOUNT, 0, 0) For i = 0 To Lines - 1 'Retrieve the offset of first character in the line charOffset = SendMessage(WinH, EM_LINEINDEX, i, 0) 'Now get the length of the line LineLength = SendMessage(WinH, EM_LINELENGTH, charOffset, 0) 'Debug.Print LineLength sFileName = Mid$(txtNames.Text, charOffset + 1, LineLength) Debug.Print sFileName If sFileName = ListView1.ListItems(1).Text Then GoTo repeat sFileName = Rep(sFileName, "=", "") sFileName = Rep(sFileName, "G,", "") sFileName = Rep(sFileName, "H,", "") sFileName = Rep(sFileName, "U,", "") sFileName = Rep(sFileName, "R,", "") sFileName = Rep(sFileName, "P,", "") sFileName = Rep(sFileName, "'", "'") sFileName = Rep(sFileName, "G,", "") sFileName = Rep(sFileName, "S,", "") sFileName = Rep(sFileName, vbCrLf, "") sFileName = Rep(sFileName, vbLf, "") sFileName = Rep(sFileName, vbCr, "") sFileName = Rep(sFileName, Chr$(10), "") sFileName = Rep(sFileName, Chr$(13), "") sFileName = Rep(Rep(Rep(sFileName, ".", "."), "@", "@"), "+", "") If sFileName <> "" And sFileName <> ListView1.ListItems(ListView1.ListItems.Count).Text And sFileName <> serverhost And sFileName <> RmName Then lst.ListItems.Add , sFileName, sFileName End If If sFileName Like ".*" Then Me.BeGold (sFileName) If sFileName Like "@*" Then Me.BeHost (sFileName) If sFileName Like "*'*" Then Me.BeGuide (sFileName) Label1.Caption = lst.ListItems.Count + 1 & " People Chatting." repeat: Next i End Sub[/code:1:1aebf7744e] maar hij blijft hangen op sFileName = Mid$(txtNames.Text, charOffset + 1, LineLength) en de txtNames.Text ziet er zo uit: [code:1:1aebf7744e] VB_client_testing = H,U,R,VB_client_testing H,U,P,+ вяγ H,U,P,.Amsterdamn G,U,P,.«ÃLÃŽ_G H,U,P,+H33TWIJFIE H,U,P,+gekkedapperesjaak VB_client_testing = H,U,P,+DannyIzBackhehehe H,U,P,+18miranda H,U,P,+SuperVagetto G,U,P,+DeAdLy_VeNoM H,U,R,+Webagent00 VB_client_testing = H,U,R,+WA009 H,U,P,.Guardian007 G,U,R,@«Fxñ•²•§ñþ» G,U,R,@Loon H,U,P,+þëиÇî†ÿÞẫ®†Ÿþяล©†آ†ïõŋэя [/code:1:1aebf7744e] ik wil dus die namen aan "lst" toevoegen wat doe ik fout?

Beantwoord deze vraag

Weet jij het antwoord op deze vraag? Registreer of meld je aan met je account

Dit is een gearchiveerde pagina. Antwoorden is niet meer mogelijk.