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 8547865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:21:40+00:00 2026-06-11T13:21:40+00:00

I need to take the first 5 characters so they match back up with

  • 0

I need to take the first 5 characters so they match back up with the picturebox I saved early with the same name.

This filename as an example could be 12345_Text_Text_Text.pdf

Dim key As String = Path.GetFileNameWithoutExtension(e.Name)
Dim p As PictureBox = CType(Me.Controls(key), PictureBox)
p.Image = My.Resources.Ok

I thought doing this would’ve worked;

Dim subkey As String
Dim key As String = Path.GetFileNameWithoutExtension(e.Name)
subkey = Left(key, 5)

The problem seems to the Left command, Public Property Left As Integer' has no parameters and its return type cannot be indexed.

Full sub routine here;

    Private Sub Watcher_Changed(ByVal sender As Object, ByVal e As FileSystemEventArgs) Handles Watcher.Changed

    Dim key As String = Path.GetFileNameWithoutExtension(e.Name)

    Dim subkey As String
    subkey = Left(key, 5)

    Dim p As PictureBox = CType(Me.Controls(key), PictureBox)
    p.Image = My.Resources.Ok

    End Sub

Suggestions on what I’m doing wrong?

  • 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-06-11T13:21:41+00:00Added an answer on June 11, 2026 at 1:21 pm

    Change your call to to the following:

    subkey = Strings.Left(key,5);
    

    Left is a static method attached to instances of the Strings object, so your problem was just one of notation (standalone Left reference).

    Hope this helps fix the problem.

    EDIT for clarification/demonstration:

    As noted by @SSS below, Forms in WinForms projects have a Left property that defines the horizontal position of the form on the screen. When the “Left” method was called without qualification, eg no object or namespace reference preceding it, VB went to its resolution process to determine how to interpret it. That native “Left” property of the form was the “winner,” but with the arguments provided caused the error you received.

    To resolve name conflicts like this, the solution is to provide what’s called a fully qualified reference to the method or property in question. Supplying “Microsoft.VisualBasic.Left” is a perfectly valid way of resolving this, as is supplying the reference to the Strings class as noted here.

    I hope this helps clear up any confusion.

    As there may be some minor uncertainty or confusion on this suggested fix, here are some screenshots of it being used in a test project:

    Visual Studio 2010 VB.NET test project code using Strings.Left

    Sample code using Strings.Left in VB.NET…

    Test project output

    Result from sample code

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

Sidebar

Related Questions

This is my first post here. I have a problem. I need to take
i need to take some row. They came from sql TARIH (sql column) is
Hi I need to sort a list then take the first 6 in .net
For this code i need to take a string like <b>hey</b> more text<b>hey2</b> other
I'm supposed to write this c++ that take in 01 and on. for example:
I need a function that will take in a list of characters and numbers,
Need to take a SELECT drop down list options and find if any of
I need to take offline and offline JOBS of schema B while I'm logged
I need to take a large file, with lines such as: member: cn=user0001,ou=people And
I need to take a C++ vector with potentially a lot of elements, erase

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.