How to assign image from file into ggc record field cell?
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
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
SIGN IN To post a reply.
2 Replies
AD
Administrator
Syncfusion Team
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
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
AD
Administrator
Syncfusion Team
May 8, 2008 02:50 AM UTC
Hello Johnson,
Thank you for your assist.
Thank you for your assist.
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
HA Harry
- Mar 4, 2008 03:07 PM UTC
- May 8, 2008 02:50 AM UTC