Click here to Skip to main content
16,010,022 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Run application on windows start up Pin
hrishiS18-May-09 21:37
hrishiS18-May-09 21:37 
AnswerRe: Run application on windows start up Pin
MohammadAmiry19-May-09 1:19
MohammadAmiry19-May-09 1:19 
AnswerRe: Run application on windows start up Pin
Tom Deketelaere19-May-09 1:54
professionalTom Deketelaere19-May-09 1:54 
QuestionXML Serialization Pin
MrColeyted18-May-09 21:06
MrColeyted18-May-09 21:06 
AnswerRe: XML Serialization Pin
nlarson1119-May-09 5:00
nlarson1119-May-09 5:00 
GeneralRe: XML Serialization Pin
MrColeyted19-May-09 6:06
MrColeyted19-May-09 6:06 
GeneralRe: XML Serialization Pin
nlarson1119-May-09 7:41
nlarson1119-May-09 7:41 
QuestionDynamically Loading Image in Crystal Report Pin
Ovais Memon18-May-09 20:46
Ovais Memon18-May-09 20:46 
I have a field of Image path on database and I need to display the image of student in crystal report. I am using VS2005 with crystal report version 9. I have added the unbound column named "Image" of type system.byte in Data Set and at the load event, I have write the following code.


Dim da As New DataSet1TableAdapters.AdmissionFormTableAdapter
Dim dt As New DataSet1.AdmissionFormDataTable
da.FillByStudentID(dt, _studentID)
Dim dtCopy As New DataTable


'''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Code Start to Set Image
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim blankFile As String = "C:\Program Files\blank.JPG"

If dt.Rows(0).Item("ImagePath").ToString <> "" Then
Dim s As String = dt.Rows(0).Item("ImagePath").ToString
If FileIO.FileSystem.FileExists(s) Then

Dim fs As FileStream = New FileStream(s, FileMode.Open, FileAccess.Read)
Dim image(fs.Length) As Byte

fs.Read(image, 0, Convert.ToInt32(fs.Length))
dt.Rows(0).Item("Image") = image
fs.Close()
Else
Dim fs As FileStream = New FileStream(blankFile, FileMode.Open, FileAccess.Read)
Dim image(fs.Length) As Byte

fs.Read(image, 0, Convert.ToInt32(fs.Length))
dt.Rows(0).Item("Image") = image
fs.Close()
End If
Else
Dim fs As FileStream = New FileStream(blankFile, FileMode.Open, FileAccess.Read)
Dim image(fs.Length) As Byte

fs.Read(image, 0, Convert.ToInt32(fs.Length))
dt.Rows(0).Item("Image") = image
fs.Close()
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Code End to Set Image
'''''''''''''''''''''''''''''''''''''''''''''''''''''''

dtCopy = dt.Copy
Me.rptAdmissionForm1.SetDataSource(dtCopy)
Me.rptAdmissionForm1.SetParameterValue("ID", _studentID)


When I run the code, error comes that "unable to cast type of system.byte to system.IConvertible",
although the datatype of column "Image" is system.byte, and when I debug the code, it shows the datatype of dt.Rows(0).Item("Image") = System.DBNull, Please help me out..!
QuestionRandom Numbers Pin
GregoryWB18-May-09 15:08
GregoryWB18-May-09 15:08 
AnswerRe: Random Numbers Pin
_Damian S_18-May-09 15:25
professional_Damian S_18-May-09 15:25 
GeneralRe: Random Numbers Pin
GregoryWB18-May-09 15:39
GregoryWB18-May-09 15:39 
AnswerRe: Random Numbers Pin
Luc Pattyn18-May-09 15:38
sitebuilderLuc Pattyn18-May-09 15:38 
GeneralRe: Random Numbers Pin
GregoryWB18-May-09 15:42
GregoryWB18-May-09 15:42 
GeneralRe: Random Numbers Pin
Luc Pattyn18-May-09 15:58
sitebuilderLuc Pattyn18-May-09 15:58 
GeneralRe: Random Numbers Pin
_Damian S_18-May-09 17:13
professional_Damian S_18-May-09 17:13 
AnswerRe: Random Numbers Pin
TheMrProgrammer19-May-09 3:02
TheMrProgrammer19-May-09 3:02 
QuestionDesign Logic for Simple Application Pin
Nielvh18-May-09 12:42
Nielvh18-May-09 12:42 
AnswerRe: Design Logic for Simple Application Pin
_Damian S_18-May-09 14:10
professional_Damian S_18-May-09 14:10 
GeneralRe: Design Logic for Simple Application Pin
Nielvh18-May-09 20:14
Nielvh18-May-09 20:14 
GeneralRe: Design Logic for Simple Application Pin
_Damian S_18-May-09 20:45
professional_Damian S_18-May-09 20:45 
AnswerRe: Design Logic for Simple Application Pin
Mycroft Holmes18-May-09 16:23
professionalMycroft Holmes18-May-09 16:23 
Questionproblem of save in excel Pin
nazimghori18-May-09 5:52
nazimghori18-May-09 5:52 
AnswerRe: problem of save in excel Pin
Ray Cassick18-May-09 8:39
Ray Cassick18-May-09 8:39 
AnswerRe: problem of save in excel Pin
Ray Cassick18-May-09 8:42
Ray Cassick18-May-09 8:42 
AnswerRe: problem of save in excel Pin
Dave Kreskowiak18-May-09 8:46
mveDave Kreskowiak18-May-09 8:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.