.Net Error: The Key Was not present in the dictionary RRS feed

  • Question

  • The Key Was not present in the dictionary issue is facing in VS 2010 solution while saving a data. PLease help me. Its very urgent
    Wednesday, February 13, 2019 10:47 AM

All replies

  • Hard to say w/o seeing your code. Here is an example to consider.

    var dictionary = new Dictionary<string, string>()
        {"Owner","Karen Payne"},
        { "VP", "Mary Payne" }
    var key = "Owner";
        .ContainsKey(key) ? dictionary[key] : $"{key} not found");
    key = "Owners";
        .ContainsKey(key) ? dictionary[key] : $"{key} not found");

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, February 13, 2019 1:29 PM
  • Hi Deepak,

    Thank you for posting here.

    For your question, could you provide the related code about your issue?

    We are waiting for your update.

    Best regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, February 14, 2019 2:55 AM