|
I can not figure out how load the file into my bitmap without getting an error with Option Strict set to ON (It works fine with Option Strict OFF .. )
<br />
Public BitmapImage As Bitmap<br />
<br />
BitmapImage = Bitmap.FromFile(filename) <br />
<br />
' where file name is soemthing like<br />
' "C:\Project\Prolasspecial.bmp"
What's the "correct" way of coding this, so that Option Strict On will not complain ??
Georg
|
|
|
|
|
Option Strict OFF is the same as 'I am not a programmer'.
The problem is simple. Bitmap.FromFile returns an image, not a bitmap. Yes, this is stupid.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I understand that .fromFile returns an Image = question remains what's the correct function to use to load my Bitmap file into my bitmap ??
How do I Convert it?
I goggled it - but it seems everybody else has figured this one out or the offered solutions seem rather "complicated" to me
Im I using the wrong Load function ?
Is there a direct conversion from Image to Bitmap?
Whats the "proper" way of doing this?
Do I need to load it into an Image first and then use a conversion ???
Georg
|
|
|
|
|
Christian Graus wrote: The problem is simple. Bitmap.FromFile returns an image, not a bitmap. Yes, this is stupid.
Well...not entirely since FromFile is actually inherited from the Image class.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
The Bitmap class has a constructor that takes a path to a file and a constructor which takes an image. The best option would be something like this:
Public BitmapImage As Bitmap
BitmapImage = New Bitmap(filename)
' or
BitmapImage = New Bitmap(Bitmap.FromFile(filename)) I think the first option is simpler.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Thanks - you guys are great!
I knew there had to be a simple solution ....
georg
|
|
|
|
|
Georg Kohler wrote: Thanks - you guys are great!
I knew there had to be a simple solution ....
You're welcome. Best place to look first is always the documentation.
Scott Dorman Microsoft® MVP - Visual C# | MCPD
President - Tampa Bay IASA
[ Blog][ Articles][ Forum Guidelines] Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
|
|
|
|
|
Hi
I want to catch the IHTMLElement2.onscroll even and using the following code:
AddHandler aBody2.onscroll, New mshtml.HTMLElementEvents2_onscrollEventHandler(AddressOf Me.aBodyEvents_onscroll)
but VS2008 is saying that onscroll is not an event of IHTMLElement2 , please tell me how to attach to this event.
Another approach I used is as following:
This event is appearing as an object to IHTMLelement2 object and when I declare an instance of HTMLElementEvents2 using following:
Dim WithEvents aBodyEvents As HTMLElementEvents2_Event
aBodyEvents = DirectCast(document.body, HTMLElementEvents2_Event)
then VS2008 is showing that it has the onscroll event but it doesnt fire at all.
Please help me.
Thanks and Regards,
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
Hi
It is solved now, Thanks.
Thanks,
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
In VB.NET or C# can I pass a routine or a function to another routine or function? If yes, how?
|
|
|
|
|
Yes, it is called a delegate. It in essence allows you to create a variable that is an actual function pointer and pass that to a routine or function.
|
|
|
|
|
If anyone out there has some good code for importing Excel files into a SQL database using VB.Net, can you please share it so i can use it in my project. Basically what i want is an open file dialog to where you can select the file to import and a combo box display the different sheets of the file. Thanks.
|
|
|
|
|
Try a search here on CP, here are lots of articles about doing this
Bob
Ashfield Consultants Ltd
|
|
|
|
|
|
Hi!
I'm using the code in this article:
Walkthrough: Printing a Local Report without Preview (http://msdn.microsoft.com/en-us/library/ms252091.aspx)
I have an image in the report and it gets blurry/unsharp when printed.
I can export the report to PDF and print it, and then the result is good. But I don't want to rely on Acrobat.
Is there a way to solve this?
/Henrik
|
|
|
|
|
Hi,
I wanna change the system date time format and resolution
For system date time format i used this code
<br />
Dim tmpCurrentCulture As System.Globalization.CultureInfo<br />
tmpCurrentCulture = New System.Globalization.CultureInfo("en-US")<br />
<br />
tmpCurrentCulture.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy"<br />
System.Threading.Thread.CurrentThread.CurrentCulture = tmpCurrentCulture<br />
MsgBox(System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortDatePattern.ToString)<br />
<br />
it shows the format MM/dd/yyyy but when i check i controlpanel->regional settings->customise date the format is not changed to MM/dd/yyyy
And second thing how can i change the resolution 1024 by 768 pixcel
Thanks with anticipations
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
|
|
|
|
|
Well, the date time format question is easy. All you have done is set the currenlty running thread to the new date format, not the PC.
There was another post recently about how to change the system date and/or format, it should point you in the right direction - and probably for the resolution settings too.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks for reply
Actually i wanna change the system short date format for doing this i have tried registery and Current Thread Culture but it fails in some condintion so i wanna do it in right way with also change the resolution of Pc
Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...
|
|
|
|
|
Hi ALL,
I have on desktop application.
When the application loads, i want the hotkeys to be displayed without ALT keystroke.
For this i used Sendkeys in form load event.
But when application starts, if i click on desktop area before form loads and appears then it does not show hotkeys otherwise it works fine.
I also tried form activated event, but the result is same.
Is there any solution.....
Regards
-Sifar
|
|
|
|
|
have u tried shown event ??
Abhishek Sur
|
|
|
|
|
I WANT TO USE PROGRESS BAR CONTROLL WITH MY VB APPLICATIONS. SUCH AS TIME TAKING PROCESS. WHEN GENERATING A REPORT WITH LARGE SUM OF DATA. WHEN SAVE LARGE DATA.
THE OTHER IS I WANT TO ADD SOME ICONS TO MENUS IN MY VB APPLICATION. I TRIED IT BUT IT DIDN'T WORK I HOPE QUICK ANSWER FOR THESE TWO QUESTIONS.
THANKS
JANAKA RUWAN
|
|
|
|
|
You should never use CAPS, this is considered as rude.
janaka ruwan wrote: I HOPE QUICK ANSWER FOR THESE TWO QUESTIONS
www.rentacoder.com
janaka ruwan wrote: I WANT TO USE PROGRESS BAR CONTROLL WITH MY VB APPLICATIONS. SUCH AS TIME TAKING PROCESS. WHEN GENERATING A REPORT WITH LARGE SUM OF DATA. WHEN SAVE LARGE DATA.
Have a look here[^]
janaka ruwan wrote: THE OTHER IS I WANT TO ADD SOME ICONS TO MENUS IN MY VB APPLICATION
I dont think, VB 6 support menu icons
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Please don't use all caps. That is considered shouting.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hi
Is there any way to understand a running application is calling a function, method or sub? In other words I want to communicate with other running proccesses.
For example I want to know when Notepad.exe is calling the Open function.
Thanks.
|
|
|
|
|
This is considered as rude to double post.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|