Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 24th, 2012, 01:16 AM
Authorized User
 
Join Date: Aug 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Priblem with picturebox and icon from .resx file

Hi,

I am working on a vb6 to vb.net migration project using VS 3.5. In my application, there is .resx file and some icons are there in this file (eg: icoIN,icoUS etc). On click of a checked listbox (which is filled with country names), the particular country flag should be displayed on a picture box control. The image of country flag is taken from the .resx file.I tried with the following code.
Code:
Try
Dim iconStream As Stream = Nothing
Dim bmp As Bitmap = Nothing
'lstcountries is the checkedlistbox and imgcountry is the picturebox
If lstcountries.getitemchecked(EventArgs.index) Then
imgcountry.visible = True
iconStream = System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream("icoIN")
bmp = New Bitmap(iconStream)
imgcountry.image = bmp
EndIf
Catch ex As Exception
EndTry
but the iconstream is returning an empty value and the picture box not displaying any image. Can anybody help me on this issue.
Any help appreciated.
Regards,
Sumith.
__________________
sumith
 
Old June 1st, 2012, 03:12 AM
Authorized User
 
Join Date: Aug 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
I resolved the issue.

Code:
Dim bitmap As Bitmap
bitmap = CType(My.Resources.ResourceManager.GetObject("B"), Icon).ToBitmap
PictureBox1.Image = CType(bitmap, Image)
where, B is the name of the icon in the resource file.
__________________
sumith





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a icon file to my exe file Waterharbin C# 2008 aka C# 3.0 2 June 14th, 2011 07:10 AM
Make IE use fi resx file smiller ASP.NET 2.0 Professional 1 December 4th, 2005 06:25 AM
Change File Icon red4vbs VBScript 1 January 23rd, 2005 12:19 PM
import Cristal report in resx file lpastor C# 1 March 1st, 2004 07:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.