carry on from the last question the "selectpicturedialog", i now faced another problem.
I have a picturebox which display photo which i selected in the dialog, i save the image path to a sql database along with some other data.
it all save & load fine from the database.
then i went on and test to save no image in the picturebox and just the text data. so , in the database image column is "null", it saved well. but i can not load it. it gave me an error.
here my code: the red part causes the problem
Code:Private Sub FoodjournalDataGrid_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles FoodjournalDataGrid.Click Dim currentrow As Integer = FoodjournalDataGrid.CurrentRowIndex Dim img As String If FoodjournalDataGrid.VisibleRowCount <> 0 Then DateTimePicker1.Value = FoodjournalDataGrid.Item(currentrow, 0) TextBox1.Text = FoodjournalDataGrid.Item(currentrow, 1) img = FoodjournalDataGrid.Item(currentrow, 2) If img = String.Empty Then PictureBox1.Image = Nothing Else PictureBox1.Image = New Bitmap(img) End If Else MsgBox("No record found") End If FoodjournalDataGrid.Visible = False End Sub




Reply With Quote