Visual Basic innertext.contians

Posted on 2012-08-25
Last Modified: 2012-08-25
My test was a msgbox("SKU Found"), is there away to have it find the word and then grab the digits next to it.

This is inside the innertext, but I would like to extract only 1000001, is this possible, truly need some help with the code, I have spent mutiple hours on the EE forum searching, and managed to get to this point.


If curElement.InnerText.Contains("SKU #")  Then

End If

Open in new window

Question by:-Geek
    LVL 85

    Accepted Solution

    Assuming there is always a space after the number:
            Dim skuTag As String = "SKU #"
            Dim index As Integer = curElement.InnerText.ToUpper.IndexOf(skuTag)
            If index <> -1 Then
                Dim SKU As String = curElement.InnerText.Substring(index + skuTag.Length).Split(" ")(0)
            End If

    Open in new window

    LVL 1

    Author Comment

    Is there away to loop and grab all SKU's, I am very sorry I thought I put that in the question.
    LVL 1

    Author Closing Comment

    Idle_Mind, thank you for helping here. After thinking about this it would only be fair to ask a new question, as you answered my question.


    New Question can be located:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Article by: jpaulino
    XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now