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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:28:23+00:00 2026-06-16T18:28:23+00:00

Whilst creating this program in visual studio 2010 i have encountered a problem. I

  • 0

Whilst creating this program in visual studio 2010 i have encountered a problem.

I read in contents of a textfile and search through each line to make sure when adding a new product, that their are no existing IDs the same. contents of file look like this:

0001|Unsmoked Middle Bacon
0002|Smoked Middle bacon
0003|Unsmoked Bits

So if a user tries to add a value ‘0001’ it springs an error. Only my code is springing an error…

appPath = Application.StartupPath
    productDB = New Dictionary(Of Integer, String)
    For Each line In IO.File.ReadAllLines(appPath & "/productlist.txt")
        Dim data = line.Split("|")
        productDB.Add(CInt(data(0)), data(1))
    Next


 If productDB.ContainsKey(newID) Then
        MsgBox("Prompt of same ID")
    Else
        MsgBox("Accepted fine")
    End If

on the line – productDB.Add(CInt(data(0)), data(1)) – I seem to be springing the error

ArgumentException was unhandled.

An item with the same key has already been added.

Alot of people have been mentioning their resources.resx file messing things up, but i have tried all sorts and nothing seems to be helping 🙁

cheers,
robbie.

  • 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-16T18:28:24+00:00Added an answer on June 16, 2026 at 6:28 pm

    My own silly mistake.

    There was already a duplicate entry within the textfile. (I had about 40 lines)

    So it wasn’t anything to do with the 4 digits I was wanting to enter, the error was happening upon reading in each line.

    "D'oh" - Homer Simpson
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

VS2010 Performance Issues I've been having a problem with Visual Studio creating lag whilst
Whilst I'd love to solve this problem in python, I'm stuck in Delphi for
I have this class for creating a thread in Java package org.vdzundza.forms; import java.awt.Graphics;
I have been struggling with this one, hopefully it will help someone else. Whilst
Whilst creating an inline ANTLR Tree Grammar interpreter I have come across an issue
This is a subject of common discussion, but through all my research I have
For a long time now I have been searching through the forum whilst teaching
Ran into this error message whilst developing tonight: SQLite3::BusyException: database is locked: I have
In Visual Studio 2008 (and others) when creating a .NET or silverlight application if
Whilst working on some generally horrible Javascript code this morning, I came across the

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.