473,320 Members | 1,883 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Convert String to Image

Well, this is the last step (I hope). I use the following code to write a
background image path to an xml file:

Dim dr31 As DataRow = ds.Tables("MainForm").NewRow

dr31("Width") = Me.Width

dr31("Height") = Me.Height

Dim frmback As String = (OpenFileDialog2.FileName).ToString

dr31("Background") = frmback
Here is the xml file:

<MainForm>

<Width>640</Width>

<Height>458</Height>

<Background>C:\CPViewer\Background.jpg</Background>

</MainForm>

</CPViewer>



As per my other thread on color, how do I now read this in from the dataset
and convert the string to an image? Or maybe, how do I right it out
properly? Here is my read code:

Me.Width = ds.Tables(30).Rows(0).Item(0).ToString

Me.Height = ds.Tables(30).Rows(0).Item(1).ToString

'bmGlobal = ("C:\cpviewer\backgroung.jpg").ToString

Me.BackgroundImage = bmGlobal

End If

Me.CenterToScreen()
You can see, I've tried a few things but no luck as of yet.

Thanks,
John


Nov 20 '05 #1
5 10442
ISK
Me.BackgroundImage = New Bitmap("C:\cpviewer\backgroung.jpg")
or Me.BackgroundImage = New Bitmap(bmGlobal) if you assigned your
image path to 'bmGlobal'.

hope this helps..

"jcrouse" wrote:
Well, this is the last step (I hope). I use the following code to write a
background image path to an xml file:

Dim dr31 As DataRow = ds.Tables("MainForm").NewRow

dr31("Width") = Me.Width

dr31("Height") = Me.Height

Dim frmback As String = (OpenFileDialog2.FileName).ToString

dr31("Background") = frmback
Here is the xml file:

<MainForm>

<Width>640</Width>

<Height>458</Height>

<Background>C:\CPViewer\Background.jpg</Background>

</MainForm>

</CPViewer>



As per my other thread on color, how do I now read this in from the dataset
and convert the string to an image? Or maybe, how do I right it out
properly? Here is my read code:

Me.Width = ds.Tables(30).Rows(0).Item(0).ToString

Me.Height = ds.Tables(30).Rows(0).Item(1).ToString

'bmGlobal = ("C:\cpviewer\backgroung.jpg").ToString

Me.BackgroundImage = bmGlobal

End If

Me.CenterToScreen()
You can see, I've tried a few things but no luck as of yet.

Thanks,
John



Nov 20 '05 #2
"jcrouse" <me> schrieb

'bmGlobal = ("C:\cpviewer\backgroung.jpg").ToString

Me.BackgroundImage = bmGlobal

End If

Me.CenterToScreen()
You can see, I've tried a few things but no luck as of yet.


You can pass the filename to the constructor of the bitmap class or to
Image.Fromfile. Assign the image to the BackgroundImage property.

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Hi John,

If you want it I have made a sample to write the bitmap to the XML file,
however your XML file becomes that a little bit larger.

Cor
Nov 20 '05 #4
* "jcrouse" <me> scripsit:
Dim frmback As String = (OpenFileDialog2.FileName).ToString


Just FYI: 'OpenFileDialog2.FileName' is already a string, so you don't
need to call 'ToString'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5
Resolved!

Thanks,
John

"jcrouse" <me> wrote in message news:uo*************@TK2MSFTNGP12.phx.gbl...
Well, this is the last step (I hope). I use the following code to write a
background image path to an xml file:

Dim dr31 As DataRow = ds.Tables("MainForm").NewRow

dr31("Width") = Me.Width

dr31("Height") = Me.Height

Dim frmback As String = (OpenFileDialog2.FileName).ToString

dr31("Background") = frmback
Here is the xml file:

<MainForm>

<Width>640</Width>

<Height>458</Height>

<Background>C:\CPViewer\Background.jpg</Background>

</MainForm>

</CPViewer>



As per my other thread on color, how do I now read this in from the dataset and convert the string to an image? Or maybe, how do I right it out
properly? Here is my read code:

Me.Width = ds.Tables(30).Rows(0).Item(0).ToString

Me.Height = ds.Tables(30).Rows(0).Item(1).ToString

'bmGlobal = ("C:\cpviewer\backgroung.jpg").ToString

Me.BackgroundImage = bmGlobal

End If

Me.CenterToScreen()
You can see, I've tried a few things but no luck as of yet.

Thanks,
John



Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: JimMenees | last post by:
I know there's an easy answer to this which is escaping me: -------------------------------------------------------------------------- ----------------------- I have clickable thumb images which...
1
by: mevar81 | last post by:
Hello to everybody.I have a problem.I used a TypeDescriptor to retrieve a TypeConverter to convert an Image to a string.The problem is that it converts the image to the string...
3
by: dale zhang | last post by:
Hi, I am trying to read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp The article author is using PictureBox for windows...
4
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any...
4
by: Harry Hudini | last post by:
Hi, I need to run exactly this code in an asp.net file when someone uploads an image, but i dont know C# and im having real issues converting it. If anyone can, could you convert it to VB.net...
1
by: Daniel | last post by:
I have looked everywhere on the web for an answer to this and the only thing I can find is converting the image format when the file is present on the local filesystem. What I want to do is use a...
7
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
2
by: UJ | last post by:
I have need to convert a text string (with formatting) to an image. This is so that I can resize the image to different sizes and the formatting stays exactly the same regardless of the size. I...
5
by: Trammel | last post by:
Hi, I have a vb.net program made to grab screenshots and then store them in image objects. The image is displayed in a pictureBox atm but I want to store the data in a String only. (Without...
0
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.