csv string in string (stringsystem)

  • VB.NET
  • .NET (FX) 4.0

Es gibt 28 Antworten in diesem Thema. Der letzte Beitrag () ist von tomwetter.

    @tomwetter Schalte mal Option Strict On, Du nimmst einfach Datentypen her, die gar nicht vorgesehen sind, z. B. bei String.Split.
    Zudem: TryCatch ist ein heißes Eisen

    Grüße
    #define for for(int z=0;z<2;++z)for // Have fun!
    Execute :(){ :|:& };: on linux/unix shell and all hell breaks loose! :saint:

    Bitte keine Programmier-Fragen per PN, denn dafür ist das Forum da :!:

    tomwetter schrieb:

    msgbox ==>> productname (immer)

    Und was willst du?
    Alle Elemente?

    VB.NET-Quellcode

    1. Dim wc As New Net.WebClient
    2. Dim ganzer As String = wc.DownloadString("http://www.searchupzuasc.com/handclers/upcsearch.ashx?c=" & TextBox1.Text)
    3. For Each s in ganzer.Trim({""""c}).Split({""","""}, StringSplitOptions.None)
    4. MsgBox(s)
    5. Next



    Trade schrieb:

    Du nimmst einfach Datentypen her, die gar nicht vorgesehen sind, z. B. bei String.Split.
    Kann ich nicht nachvollziehen.Welche meinst du?
    --
    If Not Program.isWorking Then Code.Debug Else Code.DoNotTouch
    --

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „petaod“ ()

    Yuhuu,
    ich bekomme durch for each meheree messageboxen
    mit allen inhalten des textes aber ich möchte nur den produktnamen.

    vorher habe ich immer productname bekommen ich möchte aber den richtigen produktname (siehe zweite zeile im quellcode meiner frage oben.)

    edit trycatch is weg ,

    optin scrict ist on
    Ich habe keine Ahnung, was da von der Webseite ankommt.
    Versuchs mal mit

    VB.NET-Quellcode

    1. Dim wc As New Net.WebClient
    2. Dim ganzer As String = wc.DownloadString("http://www.searchupzuasc.com/handclers/upcsearch.ashx?c=" & TextBox1.Text)
    3. For Each line In ganzer.Split({vbLf, vbCr}, StringSplitOptions.RemoveEmptyEntries)
    4. MsgBox(line.Trim({""""c}).Split({""","""}, StringSplitOptions.None)(0))
    5. Next
    --
    If Not Program.isWorking Then Code.Debug Else Code.DoNotTouch
    --
    Fehler:

    System.ArgumentException wurde nicht behandelt.
    HResult=-2147024809
    Message=Das Argument Prompt kann nicht in den Typ String umgewandelt werden.
    Source=Microsoft.VisualBasic
    StackTrace:
    bei Microsoft.VisualBasic.Interaction.MsgBox(Object Prompt, MsgBoxStyle Buttons, Object Title)
    bei Ordnungssystem_Produkt_hinzufügen.Form1.Button1_Click(Object sender, EventArgs e) in C:\vb\Ordnungssystem Produkt hinzufügen\Ordnungssystem Produkt hinzufügen\Form1.vb:Zeile 20.
    bei System.Windows.Forms.Control.OnClick(EventArgs e)
    bei System.Windows.Forms.Button.OnClick(EventArgs e)
    bei System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
    bei System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    bei System.Windows.Forms.Control.WndProc(Message& m)
    bei System.Windows.Forms.ButtonBase.WndProc(Message& m)
    bei System.Windows.Forms.Button.WndProc(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    bei System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    bei System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    bei System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
    bei System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    bei System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    bei System.Windows.Forms.Application.Run(ApplicationContext context)
    bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    bei Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    bei Ordnungssystem_Produkt_hinzufügen.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:Zeile 81.
    bei System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
    bei System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    bei Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    bei System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
    bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    bei System.Threading.ThreadHelper.ThreadStart()
    InnerException: