Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6650289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:52:29+00:00 2026-05-26T00:52:29+00:00

Possible Duplicate: substring and the indexOf method I have this problem that I’m going

  • 0

Possible Duplicate:
substring and the indexOf method

I have this problem that I’m going in circles on. The error message is “no accessible IndexOf can be called with these arguments.”

My professor said that “to search for the string Los Angeles and substring will return it from the textbox, but it needs to know what position to start returning a word at, and that is where the IndexOf comes in.” Does that mean substring and IndexOf are used together? That’s what I did and may be the problem. Here’s the code:

Private Sub btnOrder_Click(ByVal sender As Object, ByVal e As EventArgs)     Handles    btnOrder.Click
    'Declare variables
    Dim Price As Decimal
    Dim txtAddress As String = "Los Angeles"
    Dim DialogResults As String

    'Begin If Statements to determine whether value is a number

    If IsNumeric(txtPrice.Text) Then
        MessageBox.Show("Please enter a nummeric value.", "Error Message")
    End If
    If IsNumeric(txtQuantity.Text) Then
        MessageBox.Show("Please enter a numeric value.", "Error Message")
    End If
    Try
        'Condition for Pickup days
        If radPickUp.Checked = True Then
            Price = CDec(txtPrice.Text)
        ElseIf radNextDay.Checked = True Then
            Price = CDec(CDbl(txtPrice.Text) * 0.01)
        ElseIf radDays.Checked = True Then
            Price = CDec(CDbl(txtPrice.Text) * 0.05)
        End If
        'Condition for Weekdays or Weekends pickup
        If CDbl(Str(cboDays.Text)) = -1 Then
            Price = CDec(CDbl(txtPrice.Text) * 0.0925)
        End If
        If CBool(Int(txtAddress.Substring(0, 10))) Then
            Str(txtAddress.IndexOf(11, 0))
            DialogResults = CStr(MessageBox.Show("Your order is $ " & CDbl(txtPrice.Text) - 0.05))
        Else : DialogResults = CStr(MessageBox.Show("You order is $ " & CDbl(txtPrice.Text)))

        End If
    Catch ex As InvalidCastException
        MessageBox.Show("Please enter a valid numeric value to continue.")
    End Try    
End Sub

Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
    'Reset controls
    txtPrice.Clear()
    txtQuantity.Clear()
    txtName.Clear()
    txtAddress.Clear()
    cboDays.Text = String.Empty
    txtPrice.Focus()
End Sub

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
    'Quit the application
    Me.Close()
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    MessageBox.Show("Hello", "A greeting.")
End Sub

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:52:30+00:00Added an answer on May 26, 2026 at 12:52 am

    Documentation is your friend

    You call

    Str(txtAddress.IndexOf(11, 0))
    

    Which is invalid syntax. The correct syntax is

    string.IndexOf(searchString)
    

    This returns the index position of the found string

    -1 if it is not found.

    0 if empty

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: regex for URL including query string I have a text or message.
Possible Duplicate: Is there a way to substring a string in Python? I have
Possible Duplicate: Form that removes WWW. and prints result on input? I'm using this
Possible Duplicate: Case insensitive contains(string) With Contains() method of String class a substring can
Possible Duplicate: substring algorithm Given two strings, A and B, how to find the
Possible Duplicate: Number of occurrences of a substring in an NSString? I would like
Possible Duplicate: How do I calculate someone's age in C#? Maybe this could be
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Possible Duplicate: php == vs === operator Reference - What does this symbol mean
Possible Duplicate: How to call a JavaScript function from PHP? I have a php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.