•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 392,044 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,252 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser:
Views: 403 | Replies: 1
![]() |
•
•
Join Date: Mar 2008
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
i m working on a small application
its main function is to create a album and then add photos in the album.
i m using tree view for creating album and photos
i m using tree root as album and nodes as photos.
i have to also show photos when i click on photo name
i m using function showphoto for this purpose
i m using sql server to store picture in database and then retrieve from it
but i also want to generate thumbnail when i click on album name and all the images should be displayed as thumbnail on picbox
is there any control for this purpose or how i can do that?
i m also sending this application plz help me
its main function is to create a album and then add photos in the album.
i m using tree view for creating album and photos
i m using tree root as album and nodes as photos.
i have to also show photos when i click on photo name
i m using function showphoto for this purpose
i m using sql server to store picture in database and then retrieve from it
but i also want to generate thumbnail when i click on album name and all the images should be displayed as thumbnail on picbox
is there any control for this purpose or how i can do that?
i m also sending this application plz help me
vbnet Syntax (Toggle Plain Text)
Private Sub ShowPhoto(ByVal item As TreeItem) Try ' Create a command to select the selected photo Dim strCmd As String = [String].Format("SELECT photo FROM Photos WHERE id = {0}", item.Id) Dim cmd As New SqlCommand(strCmd, sqlConn) ' Set the description lblDesc.Text = item.Desc ' Get bytes return from stored proc Dim b As Byte() = CByte(cmd.ExecuteScalar()) If b.Length > 0 Then ' Open a stream for the image and write the bytes into it Dim stream As New System.IO.MemoryStream(b, True) stream.Write(b, 0, b.Length) ' Draw photo to scale of picturebox DrawToScale(New Bitmap(stream)) ' Close the stream and delete the temp file stream.Close() End If Catch e As Exception MessageBox.Show(e.Message) End Try End Sub if i use above function to show photo error comes on this line Dim b As Byte() = CByte(cmd.ExecuteScalar()) and erroe says"Error 1 Value of type 'Byte' cannot be converted to '1-dimensional array of Byte'" if i remove Cbyte from above line then application runs well but when i click on photo name then picture doesn't appear in picturebox. and i m using showphoto function in below code snipts Private Sub treeAlbum_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles treeAlbum.AfterSelect Try ' Disable edit controls if we were in edit mode If True = btnUpdate.Visible Then btnUpdate.Visible = False txtDesc.Visible = False lblDesc.Visible = True End If ' Retrieve the item info for this node Dim item As TreeItem = DirectCast(e.Node.Tag, TreeItem) ' If the selected item is an album... If ItemType.Album = item.Type Then lblDesc.Text = item.Desc ' Set the description PictureBox.Image = Nothing ' Clear the image Return End If ' ...otherwise it is a photo ShowPhoto(item) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub using System; namespace AlbumViewer { public enum ItemType { Album, Photo }; /// <summary> /// This is a helper class to contain information about /// treeview items /// </summary> public class TreeItem { private int m_nId = 0; private ItemType m_Type = ItemType.Photo; private string m_strDesc = ""; public TreeItem(ItemType type, int nId, string strDesc) { m_Type = type; m_nId = nId; m_strDesc = strDesc; } public ItemType Type { get{ return m_Type; } } public int Id { get{ return m_nId; } } public string Desc { get{ return m_strDesc; } set{ m_strDesc = value; } } } } # Imports System # # Namespace AlbumViewer # Public Enum ItemType # Album # Photo # End Enum # # ''' <summary> # ''' This is a helper class to contain information about # ''' treeview items # ''' </summary> # Public Class TreeItem # Private m_nId As Integer = 0 # Private m_Type As ItemType = ItemType.Photo # Private m_strDesc As String = "" # # Public Sub New(ByVal type As ItemType, ByVal nId As Integer, ByVal strDesc As String) # m_Type = type # m_nId = nId # m_strDesc = strDesc # End Sub # # Public ReadOnly Property Type() As ItemType # Get # Return m_Type # End Get # End Property # Public ReadOnly Property Id() As Integer # Get # Return m_nId # End Get # End Property # # Public Property Desc() As String # Get # Return m_strDesc # End Get # Set # m_strDesc = value # End Set # End Property # End Class # End Namespace # Imports System # # Namespace AlbumViewer # Public Enum ItemType # Album # Photo # End Enum # # ''' <summary> # ''' This is a helper class to contain information about # ''' treeview items # ''' </summary> # Public Class TreeItem # Private m_nId As Integer = 0 # Private m_Type As ItemType = ItemType.Photo # Private m_strDesc As String = "" # # Public Sub New(ByVal type As ItemType, ByVal nId As Integer, ByVal strDesc As String) # m_Type = type # m_nId = nId # m_strDesc = strDesc # End Sub # # Public ReadOnly Property Type() As ItemType # Get # Return m_Type # End Get # End Property # Public ReadOnly Property Id() As Integer # Get # Return m_nId # End Get # End Property # # Public Property Desc() As String # Get # Return m_strDesc # End Get # Set # m_strDesc = value # End Set # End Property # End Class # End Namespace
Last edited by WolfPack : Mar 28th, 2008 at 9:37 am. Reason: Added code tags. Use them when you post code.
•
•
Join Date: Mar 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
I want popular my site
Title : Web Design India
http://www.webs4soft.com
http://www.webs4soft.com/Static-Website-Design.html
Hotels in India
http://hotelsinindia.webs4soft.com
http://sunnyjaswani.webs4soft.com
Real Estate India
http://real-estate.webs4soft.com
India movies
http://indianmovies.webs4soft.com
India Tour
http://indiatravel.webs4soft.com
http://aspdotnetbook.blogspot.com/
Title : Web Design India
http://www.webs4soft.com
http://www.webs4soft.com/Static-Website-Design.html
Hotels in India
http://hotelsinindia.webs4soft.com
http://sunnyjaswani.webs4soft.com
Real Estate India
http://real-estate.webs4soft.com
India movies
http://indianmovies.webs4soft.com
India Tour
http://indiatravel.webs4soft.com
http://aspdotnetbook.blogspot.com/
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
Other Threads in the VB.NET Forum
- Previous Thread: how to calculate date together
- Next Thread: convert MS Access to MS SQL Server


Linear Mode