473,503 Members | 3,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS C# Can't add image to a button in Windows.Form

11 New Member
Whenever I try to set the image property of button I get a pop-up error which states
"An item with the same key has already been added."
This error also happens whenever I create a new button and try to set the image. I have a feeling the error has something to do with the resources file for the project, any help would be greatly appreciated!!!
Dec 4 '08 #1
10 5698
tlhintoq
3,525 Recognized Expert Specialist
@DarkArchon
If you could provide a code snippet of what you are doing to create the button and assign an image that would help a lot.
Dec 5 '08 #2
Frinavale
9,735 Recognized Expert Moderator Expert
@tlhintoq
I agree, a snippet of code would really help us.

Also, could you provide more details about your problem...like...
Are you dynamically creating the button?
How are you assigning the image?

Please remember to use Code Tags when posting code.

-Frinny
Dec 5 '08 #3
DarkArchon
11 New Member
Well I would post the code except that the problem exists when I am in the designer mode. The error occurs when I click on a button, go to it's properties, and try to choose image ... button.
Dec 5 '08 #4
Frinavale
9,735 Recognized Expert Moderator Expert
Go through your buttons on the page and make sure that you have given names to all of them. Rename them and see if this helps.
Dec 5 '08 #5
DarkArchon
11 New Member
They all have names, renamed, still have the same problem.
Dec 5 '08 #6
Curtis Rutland
3,256 Recognized Expert Specialist
Well, I saw someone else had the same problem on another site, and here was the resolution:
In my case, my project has two resource files. I only have to delete one resource file, and it works.
So check for that. The resource files are the .resx files.
Dec 5 '08 #7
DarkArchon
11 New Member
well I had 2 resource files, I deleted one of them, recompiled and everything. the problem still persists.
Dec 5 '08 #8
Curtis Rutland
3,256 Recognized Expert Specialist
Maybe you deleted the wrong one? I'm out of ideas :(
Dec 5 '08 #9
DarkArchon
11 New Member
Unfortunately not. Although after checking, i find I get the same problem with labels and stuff. I wish there was a more info in the error than just 'item'
Dec 5 '08 #10
Curtis Rutland
3,256 Recognized Expert Specialist
How big is your project, and how far along are you? Would it be possible for you to start a new project and remake it? Copy and paste might be helpful.

Wish I had more help to give you.
Dec 5 '08 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1333
by: jez | last post by:
I'm programming in C# for a PPC, and trying to display an image from the start, i.e. as soon as the program launches. I've tried (as explained in Microsoft's .NET Compact Framework book) to use two...
5
2321
by: Chris | last post by:
Hi all I would appreciate some help with a program I have written from the Sams teach your self c# book. I have checked my code several times and even rewritten it. when I compile (Sharp...
2
2362
by: sunnyz | last post by:
hi all plz help me in displaying image on button in windows form from a url or website.I am using C#.The image should not be stored on local computer...the function shud get the image directly...
1
6110
by: Phil_Cam | last post by:
Hello All On a webpage I have a standard paypal image button for purchases. I am trying to set it up so that it only shows up or is endabled when text is entered into a textbox and a button is...
0
1852
by: David | last post by:
Hello all. I am trying to implement my first server control and have run into two problems that I cannot solve. I need the assistance of someone with more experience. My goal was to create an...
16
2835
by: browntown | last post by:
so I have this application I'm nearly finished with. The only thing the client has requested is the ability to submit the form by pressing "enter". I didn't think this would be a huge pain in the...
3
3959
by: forest demon | last post by:
for example, let's say I do something like, System.Diagnostics.Process.Start("notepad.exe","sample.txt"); if the user does a SaveAs (in notepad), how can i capture the path that the user...
8
5334
by: =?Utf-8?B?R3JlZyBMYXJzZW4=?= | last post by:
I'm trying to figure out how to modify a panel (panel1) from a backgroundworker thread. But can't get the panel to show the new controls added by the backgroundwork task. Here is my code. In...
2
2444
by: raylopez99 | last post by:
I can't get the below code to work, no matter how many times I change it. I do have the Image file, Image1, created (in another method), and using "hard coding" I can save it (it's a filled...
7
3719
by: dragiton | last post by:
SA Upload SQL Database variable types (image upload and storage) I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to...
0
7188
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7063
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7258
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7313
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6970
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5558
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.