|
-
Apr 6th, 2004, 02:25 PM
#1
Thread Starter
Fanatic Member
Open & Display image in win form
Hey all firstly ive kinda got two things i wana do here
1, open file dialog, select image and display it in a picture box
2, have some access to the file for uploading to a server
(2 in more detail, ive created a object in my website application for image uploading and resizing, my CMS is in fact a windows application and ive referenced the dll for the .net website in my application, so i use use most of the code in the site. i need to be able to open/show a pic and then save it along with other data to my site. saving the data works just need to sort out the image bit.
First question, how do i display the image in a picture box
Current Code
VB Code:
Private Function OpenFile() As FileStream
' Displays an OpenFileDialog and shows the read/only files.
Dim DlgOpenFile As New System.Windows.Forms.OpenFileDialog
DlgOpenFile.ShowReadOnly = True
Dim Fs As FileStream
If DlgOpenFile.ShowDialog() = DialogResult.OK Then
' If ReadOnlyChecked is true, uses the OpenFile method to
' open the file with read/only access.
If DlgOpenFile.ReadOnlyChecked = True Then
Return DlgOpenFile.OpenFile()
' Otherwise, opens the file with read/write access.
Else
'this below is wrong because its crashing out
Dim Path As String = DlgOpenFile.FileName
Dim imageStream = New FileStream(Path, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite)
Me.PictureBox1.Image.FromStream(imageStream)
Me.PictureBox1.Update()
End If
End If
Second question.
I guess i can just pass the stream to to asp.net because that using fileField to upload the file, is this correct ?
I am curretly building a defect management system for software and web developers,
If you wana try it out (beta test) and keep it for free just send me a message
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|