We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to assign image from file into ggc record field cell?

Thread ID:

Created:

Updated:

Platform:

Replies:

72133 Mar 4,2008 03:07 PM UTC May 8,2008 02:50 AM UTC Windows Forms 2
loading
Tags: GridControl
Harry
Asked On March 4, 2008 03:07 PM UTC

Hello Haneef,

I have item table and need to put different picture according to respective item name by double click the cell, then save it into dataset.

Private Sub ggc_TableControlCellDoubleClick(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs) Handles ggc.TableControlCellDoubleClick
If e.TableControl.TableDescriptor.Name = "Item" Then
Dim column As GridColumnDescriptor = e.TableControl.Table.GetColumnDescriptorAt(e.Inner.RowIndex, e.Inner.ColIndex)
If column.Name = "Photo" Then
Dim OpenFileDialog As OpenFileDialog = New OpenFileDialog()
OpenFileDialog.Title = "Load Photo"
OpenFileDialog.Filter = "Image File (*.jpg;*.gif;*.bmp)|*.jpg;*.gif;*.bmp"

If OpenFileDialog.ShowDialog() = Windows.Forms.DialogResult.OK AndAlso OpenFileDialog.CheckPathExists Then

Dim fs As New System.IO.FileStream(OpenFileDialog.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim bm As New Bitmap(fs)
...

end sub

ggc.TableDescriptor.Columns("Photo").Appearance.AnyRecordFieldCell.CellType = "PictureBox"

How to perfectly code it in VB?

Thank you for your help!

Best Regards,
Harry


Administrator [Syncfusion]
Replied On March 26, 2008 06:43 PM UTC

Hi Harry,

Here is a code snippet in VB.Net.

Private Sub gridGroupingControl1_TableControlCellDoubleClick(ByVal sender As Object, ByVal e As GridTableControlCellClickEventArgs)
'if (e.TableControl.TableDescriptor.Name == "Item")
Dim column As GridColumnDescriptor = e.TableControl.Table.GetColumnDescriptorAt(e.Inner.RowIndex, e.Inner.ColIndex)
If column.Name = "Photo" Then
Dim OpenFileDialog As OpenFileDialog = New OpenFileDialog()
OpenFileDialog.Title = "Load Photo"
OpenFileDialog.Filter = "Image File (*.jpg;*.gif;*.bmp;*.jpeg;*.png)|*.jpg;*.gif;*.bmp;*.jpeg;*.png"
If OpenFileDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK AndAlso OpenFileDialog.CheckPathExists Then
Dim fs As System.IO.FileStream = New System.IO.FileStream(OpenFileDialog.FileName, System.IO.FileMode.Open, System.IO.FileAccess.Read)
Dim bm As Bitmap = New Bitmap(fs)
Dim Rec As Syncfusion.Grouping.Record = Me.gridGroupingControl1.Table.CurrentRecord
Rec.SetValue("Photo", bm)
Me.gridGroupingControl1.Refresh()
End If
End If
End Sub

Please refer to the attached sample for implementation and let me know this helps.

http://websamples.syncfusion.com/Samples/Grid.Windows/F72133/main.htm



Best regards,
Johnson



Administrator [Syncfusion]
Replied On May 8, 2008 02:50 AM UTC

Hello Johnson,

Thank you for your assist.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;