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

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

Get pixel format, raw format, property id list and property items image in VB.net - C#.net.

Posted By: Syed Shakeer Hussain     Posted Date: August 07, 2010    Points: 2   Category :Windows Application
n this simple article you will learn that how we can get pixel format, raw format, property id list and property items image in VB and C#.net.

Get Pixel Format:

Image consists of pixels to get the format of the pixel we have a property named pixel format. This property returns an enumeration of pixel format. This enumeration tells the pixel format.

To demonstrate make a window application. Drag one button and a picture box on form.

Now write the following code on Button click event:

View Complete Post

More Related Resource Links

'No information was found about this pixel format error' on image binding

I've read all the posts I could find on this error but I'm still stumped.

I have a user control with a dependency property named Image.

In the user control I have a stack panel that contains an image and I set the binding in the xaml

<Image HorizontalAlignment="Center" Margin="3,0,0,0" Width="85" Height="75" Source="{Binding ElementName=UserControl, Path=Image}"/>

In a code behind I try to set the image for an instance of this control named WeatherNB

                BitmapImage bi1 = new BitmapImage();
                bi1.UriSource = new Uri(currentImage, UriKind.Relative);
                this.WeatherNB.Image = bi1;

but I get the following error

Unhandled Exception: System.NotSupportedException: No information was found about this pixel format.
   at System.Windows.Media.PixelFormat.CreatePixel

Format Date property



I have a date property.

I need to edit it in "dd/MM/YYYY" format. In display mode - its ok.

but when I enter the text box date this date:"31/12/2011" - it throws validation message.

In my MetaDate I did:


[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]


Web part to retrieve List Items based on configurable property


I want to create a web part that will do the following

1) Have a custom choice property based on teh Choice List Column in the list.

2) Return the records based on the custom choice selected by the user.


Is this possible?


Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


How can I get a user list based on a specific profile property.

Hi,I am trying to query a DB and get a list of users based on a specific boolean property stored in the aspnet_profile for that user.I am aware that it wasn't possible a few years ago (http://forums.asp.net/p/988051/1277359.aspx), but was wondering whether that had changed in recent releases, or it was still not possible without trawling through the entire list of users and testing them one by one.  (My DB may become way to big for that.)Thanks in advance for any help.Regards,Ben

set the Report URL property to a specific report dynamically based on the selection in the list.

Hi I want to use  embedding the Report Viewer Web Part in a Web page, and I know we  should set the Report URL property to a specific report. but  is there a way by which we can set the url  dynamically based on the selection of the report  from  the list How can I customize this  feature Any Help on this is appreciated. Thanks

Displaying Image stored in rtf format in access database displaying it on crystal report

Hello, I'm working on a C# project combined with "Crystal Reports 10". When a user inserts something in a "TextField" in my C#-Program, it's saved  as RTF-code (Bolt,Pictures,Underlined,....) to a database.. So if they  reopen it in my "C#"-program they're able to see what they've entered  including their pictures .... But when I created a "Crystal Report"-file and combined it with the same  database used in my "C#"-program, it only show the formatted text and not  the pictures or images... Is there a way to show the "Picture" or "Image" they've inserted in RTF-code  ??? When I copy the code from the database in a simple Text-File and rename  it too "Test.rtf", it wil open correctly in word (with picture and  everything else)... So I hope there is a way to get the picture, Cz it's rather important  they've got a picture of the product they wanna print ...

How to convert raster Image to Vector image format

I want to covert raster image to vector image format in  C#is it possible ??Thanks

Items collection cannot be modified when the DataSource property is set.

I am having two listboxes which performs Drag and Drop, when i drag and leave on to second listbox I am getting the error: Items collection cannot be modified when the DataSource property is set. code: using     System; using     System.Collections.Generic; using     System.ComponentModel; using     System.Data; using     System.Drawing; using     System.Linq; using     System.Text; using     System.Windows.Forms; namespace     WindowsControlEx8 {     public partial class Form1 : Form {     List<Colors> colors = new List<Colors>() {     new Colors{colorName="Red"},     new Colors{colorName="Green"},     new Colors{colorName="Black"},     new Colors{colorName="White"},     new Colors{colorName="Orange"} };         public Form1() { InitializeComponent();   }     private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { }     private void button1_Click(object sender, EventArgs e) {     var c = from c1 in colors     select c1.colorName; listBox1.DataSource = c.ToList();   } &nb

Unable to use Managed Property mapped to Choice Dropdown list column in MOSS 2007


I have a choice list column containing dropdown values. I crawled the content source and created Managed Property to map it.

Also Configured Advanced Search webpart to display the property. But when I pick the property and perform search with values then no results are returned.

Can any one can help me out.?

Thanks in Advance.!

Workflow property not showing up in bind list

Hi, apologies if there's an answer to this already, I wasn't able to find one via the search.

I have a workflow that has a property of type CustomObject, where CustomObject is an class I created with a few simple properties.  I have a custom activity in that workflow that has a dependency property of type CustomObject.

I'm trying to bind these two properties but the workflow's CustomObject doesn't show up in the 'Bind to an existing member' dialog box when I click on the bind icon in the custom activity's properties.

Now there's a twist here in that I have the CustomObject class in a separate library.  If I put it in the workflow library it DOES show up in the binding dialog.  If I put it back in the separate library it no longer appears in the dialog.

Binding the two properties in the designer adds an activity binding to the designer.cs file and if I keep that auto-generated code the workflow still works even if I move the CustomObject out to a separate library.  It just doesn't show up in the WF designer binding dialog box.

Anyone know how I can get this object to be bindable via the designer?  I don't want to have to worry about that binding code.  From what I can tell it looks like the designer filters the 'bind to existing members' dialog based on the type of the properties in the workflow and in my case it can't figure out

SOAP API Rendering In HTML4.0 format with Toggle Items

I have been combing the Internet trying to find a way to use the SOAP API 
(ReportExecution2005) web service to render a report to HTML4.0 format with 
toggle items.  From what I have read, the new web services should provide 
ASP.NET server-side postbacks from the toggle item images, but so far I have 
seen only the same behavior as was in RS 2000, which was that the toggle item 
images pointed back to the ReportServer address.  The following is the device 
info settings that i have used to get the images to show up on the aspx page:


If I switch the HTMFragment to True I don't get any toggle item images to 
render on the page but the report still shows up, and when I actually set the 
StreamRoot paramter to something like this 
"http://[server]/[virtualdirectory]/GetImage.aspx?reportpath=[path]&streamid=" to render the toggle item

Using a List(of T) as a "Property" in a class


In my application I have a class called "RCategory" as illustrated here:

Public Class RCategory
    Public Property RCatNum As Integer
    Public Property RAct As Char
    Public Property RMin As Double
    Public Property RMax As Double
    Public Property RTyp As Char 
End Class

I have another class where I want to use a List (of RCategory) as a property, to-wit:

    Public Property RpStrt As Date
    Public Property RpEnd As Date 'Plan Year End
    Public Property RCat As List(Of RCategory)
    Public Property MinFee As Double


I'm trying to add to my list using the following code:

                        For ct As Integer = 1 To 8
                            Dim c As New RCategory With {.RCatNum = ct,
                                                         .RAct = dr("RACT" & ct.ToString).ToString,
                                                         .RTyp = dr("RTYP" & ct.ToString).ToString,
                                                         .RMax = CDbl(dr("RMAX" & ct.ToString))}
                            If ct = 4 Or ct = 5 Then
                                c.RMin = CDbl(dr("RMIN" & ct.ToString))

Add image to ImageList and set File Name as Tag property


I'd like to create a thumbnail viewer to view all .jpg files within a folder.

So i create thumbnails and add them to a ImageList.

          Image img1 = Image.FromFile(fi.FullName);
          img1.Tag = fi.Name;
          imageList.Images.Add(getThumbnaiImage(imageList.ImageSize.Width, img1));

then add them to my ListView.

      for (int j = 0; j < imageList.Images.Count; j++)
        this.listView1.Items.Add("Image\n" + j);
        this.listView1.Items[j].ImageIndex = j;

Instead of the 'description' "Image\n" + j, i'd like to use the Tag property which should contain the file name.
doesn't work.

Error: System.NullReferenceException was unhandled.

How can i show the thumbnails in the ListView with the real file names ?

jpg, gif, png, bmp image format


Hello i want to appreciate u guys for answering my technical questions. I am working on a photo project and i want users to be able to upload jpg, gif, bmp,png format. Right now, the project allows only jpg image format. Can someone help me with that? My code is below: Imports System.Data Imports System.IO Imports System.Data.SqlClient

Partial Class PhotoAdmin_Default Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
    UserIdValue.Text = Membership.GetUser().ProviderUserKey.ToString() 
    cannotUploadImageMessage.Visible = False 
End Sub 

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