.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Setting form icon from embedded resource in layout

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :Windows Application
I have no trouble embedding resources into my project into the resx file and using them for things like ImageLists. For example selecting a background image for a control, I simply click on the [...] button in the properties window for background image and a popup window allows me to select "Project resource file: Resources.resx" and lists the selectable images I've already embedded to choose from.
Yet how come when I select a Form and click [...] to select its icon it forces me to browse on my hard disk for a file instead of linking directly to the already-embedded resource? I don't want to have to keep adding copies of the same icon for every form I want to apply it to. Is there a reason for this or a way around getting this to work properly using the layout manager? I've found some pages that talk about how to code it into the source and force it to work that way but I'd like to know how to do it in the designer.

View Complete Post

More Related Resource Links

C# Having trouble setting the form icon!


Hi i ma developing one application in C# for desktop system.
here i am applying icon for one form . I have applied it from properties window , but its not showing me the newly selected icon when i run the application for taskbar.

Also, i have tried applying icon from Resources path(Resource.resx) file still its not giving me the result.

This is happening for only one form in my application. Other forms are working perfectly well. These all forms are derived from one base class(Windows form)..
Can u pls suggest some solution for achieving this .?


Thank in advance
Jicky ...


display icon or colum for inserted file in infopath form

i have a list with infopath form and in this form i have insert file now i need naythin in the view say there is attached or insert file in this record like the icon for attachment or column display file name or his path ,somthink can i know in this record there is attachmentThanks for any help :) my blog is: http://www.waelk.com

Saving Canvas and other UIElements as embedded resource

Hi All, I am trying to save a canvas and its content as an embedded resource to another assembly but in doing so I got a Non-Serializable exception. Is there a better way of doing this? Here is the code I used in embedding the Canvas: // create an assembly AssemblyName assemblyName = new AssemblyName(System.IO.Path.GetFileNameWithoutExtension(filename)); AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave); ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, assemblyName.Name + ".dll"); // create a class TypeBuilder typeBuilder = moduleBuilder.DefineType("ModuleName", TypeAttributes.Public, typeof(EmbeddedBAML)); // Create a default constructor ConstructorBuilder constuctorDefault = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes); ILGenerator ilGenerator = constuctorDefault.GetILGenerator(); ilGenerator.Emit(OpCodes.Ldarg_0); ilGenerator.Emit(OpCodes.Call, typeof(EmbeddedBAML).GetConstructor(Type.EmptyTypes)); ilGenerator.Emit(OpCodes.Ret); typeBuilder.CreateType(); IResourceWriter resourceWriter = assemblyBuilder.DefineResource(assemblyName.Name + ".canvas", "Contains the Canvas object",assemblyName.Name + ".canvas", ResourceAttributes.Pu

Windows Form Resolution Setting

HI I created one application in my laptop its working correctly but when i m trying to use that one in Desktop some part of application got hide in right side of screen. I faced this problem today when i was giving the Demo on my application in college. I dont know how to make the application which will run in any system without any resolution problem.       Please help me. My project is windows based. please help me............ Thanku......... 

Setting Window.Icon to Vista 256x256 PNG icon causes a FileFormatException

If I set the Icon property to a Vista icon, I get a FileFormatException stating that the image format is unrecognized. If I try the same thing with an old Windows XP icon (without PNG compressed images) it works correctly. I simply cannot believe that WPF doesn't support Vista icons. Asbjørn

Unique Pack URIs for resources (embedded / content / resource files) in several assemblies

Hello, When using resources as files (build actione=none and copy if newer), I'm able to manage resources using something like this : "/file.ico". Whatever the owner assembly is, because all files are copied in the Debug / Release directory. I'd like to have a similar behavior with pack URIs. I don't want to specify which assembly is the owner of an embedded / content / resource file. It seems impossible because we need to specify the source assembly ("pack://assembly_08:,,,/file.ico"), I'd like something like : "pack://whatever_the_assembly:,,,/file.ico". Is it possible ? Any idea ? Thanks.

Altering in-document form layout for Document Library Columns



My users need to add metadata to documents they check out of a Document Library while they are in the document. That works fine (the forms appear at the top of the Word Document, underneath the task bar). However, the layout of the forms is kind of bad. Is there a way to redesign the forms in the top of a word document so that they look better?



Setting SharePoint 2010 Form Fields Using Query String Variables


Hi All,

I have a requirement to populate sharepoint form field value with query string while uploading document to document library.

While uploading the document to document library, I want to populate claim number available from query string in a pop up page i.e in my case EditForm.aspx, Located at http://servername:port/sitename/documentlibraryname/forms/EditForm.aspx.

Additional Information:

  • Created document library and added custom columns like claim number etc..
  • Created a view to filter uploaded documents as per claim number.

Server Details:

  • Windows Server 2008 R2
  • SharePoint 2010
  • SQL Server 2008 R2

I have written javascript for the same, but not sure where exactly to add the code in EditForm.aspx page.

Any help on this would be greatly appreciated.

Thanking you in advacne.



Form Background Color not setting



I am developing Addin for outlook and I have Windows form for which I set background color it is not setting to the color whatever I set. you help me to figure this out to reflect the required color.


Malik Z.

How to pass value from browser into embedded windows form control library


Hi all,

i have one project which i embed the windows form control library inside the web form.

now i wanna pass a url from aspx into my windows form control library.

May i know how to do this?


Form Background Color not setting



I am developing Addin for outlook and I have Windows form for which I set background color it is not setting to the color whatever I set. you help me to figure this out to reflect the required color.


Malik Z.

setting up form authentication for a specific folder


I have an "Admin" folder in my application that will include pages that I would not like to have anonymous access to.  When a user attempts to load a page that resides in this folder, I would like to redirect them to a login page. Here is what I have in my config so far.


 <authentication mode="Forms">
      <forms loginUrl="~/Admin/Login.aspx" timeout="2880" >
        <credentials passwordFormat="Clear">
          <user name ="isaac" password="****"/>          
What do I need to add to get the functionality I am lookign for. Thanks




error in sharepoint 2010 designer while saving:"Content in the embedded form may be changed by the t

I am doing development  in sharepoint 2010 and facing this very weird problem.
If I create a site page with the sharepoint look and feel for that site and try to save the site page,i am getting this error:**"Content in the embedded form may be changed by the the server to remove unsafe content.Do you want to reload your page to see the results of the save? "** and when i say reload,the server removes some parts of my page, e.g onclick event of html,asp buttons.

This error just comes for any sharepoint site page,e.g i took a copy of 'How To Read Library' page just edited the text part of taht page,and when i try to save this error again comes up.

However,if i create a simple aspx page with only htmltags like head body,then thr is no problem ,everything works great. But sharepoint look and feel pages are giving troubles while saving.

has anybody seen this earlier,what could be the reason for this?


Setting property in mother-form ???


I have a form, A, with a property _B and set/get defined as public.

From form A I start another form - a toolbox - where I can choose a value for the property _B in form A.

But how can I set the value I before I close my other form ?

(The set/get does NOT appear !)

Best regards KSor, Denmark

Setting Task Field Values in Custom .aspx Edit Form and accessing through ExtendedProperties


Since we're using WSS 3.0 and not MOSS 2007, we have to create and use ASP forms for any custom Workflow Task Edit pages instead of being able to use InfoPath forms (which would be nice...maybe some day we'll step up to MOSS). The custom Workflow Edit Pages are used for custom Task Content Types that we create so that our Workflow Tasks can have additional fields beyond the standard Workflow Task fields. Once you've collected the values for the Task fields from the user on the ASP Workflow Task Edit form, the typical procedure is to create a hashtable and fill the hashtable with key/value pairs that represent the names of your Task fields and their associated values, as such:

// This function is called when the user clicks the Save/Submit button
// on the Custom Task Edit ASP form
public void btnSubmit_Click(object sender, EventArgs e)
  // Create a hashtable that will be used to update the values of task fields
  Hashtable taskHash = new Hashtable();
  // For each field, create two values in the hashtable. If the field name 
  // matches a field in the Task content type, the field name will not be 
  // searchable as a key within the ExtendedProperties hashtable. So 
  // create a second field that is a duplicate of the first but having a 
  // name that doesn't exactly match an existing field in the Task 
  // content type. That way it will be a searchable ke

http 400 Error when performing item upload after setting custom edit form on content type



What I am trying to do is create custom edit forms for different content types within the same document library.....so basically I have done the following:

  • I have created two site content types and reconfigured my library to use CT's. 
  • I then connected to my site using SPD. 
  • When examining my library I can see that I have the two CT that I added earlier.  I then created a new editform for one the CTs using the top ribbon menu and in the drop down box associated it to the CT.  I did not select this as the default form for the library.
  • I then updated the library CT (not site CT) with the url to form in the editform properties.

When I create a document and edit the properties it works fine - totally as expected.  However when I upload a document the default EditForm for the library is used and I can select the CT to associate the document to.  When I choose the CT with the custom form the new edit form is not found and I get a page not found error - http 400.

The full url for this library is is http://XXXX/functions/ehs/CSI

So the URL I have used is /functions/ehs/CSI/Forms/EditForm2.aspx (EditForm2.aspx) is my form and this is fine.  I have even used CSI/Forms/EditForm2.aspx and this works...  BUT ne

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend