|
There is a difference between warnings and errors. Warnings are for you to know, that tere can be a potential problem, or to teach you someting, but errors occure when something goes wrong. So, I did not try actualy, but this should compile and run ok, because it has only warnings...
Good luck: Didi
|
|
|
|
|
Thanks a lot for the reply. Well this is the last issue and after that
I am done. I got 3 errors, and they were of the same type.
'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not suported.
Declare Function MyFunction2 Lib "myLib2" (ByVal arg As Any)<br />
As Integer
So can I use ByVal arg As Object instead of 'Any'?
Thanks again.
|
|
|
|
|
You should try to find out, what type the argument should be. See here[^] for reference. Good luck: Didi
|
|
|
|
|
I've got answers for everything(for now... ). Thanks a lot
|
|
|
|
|
I have an application written (VB6) a while ago and periodically updated. I keep old versions around simply by making a copy of the application source in a backup directory.
If I open the most recent version I find an error, Invalid use of Null (I know all about Nulls so lets not go down that path. Probably should have handled it better when it was originally written but when it was written we would not have had them, now we could)
If I open an older version of the program and run it, it does not give an error. This portion of code was last updated in 2003 or something and has not changed.
the offending line is
If UCase(rs!bin2File) = "CALLEDFROMDIAG" Then
in one version of code I get an error (current version), in the other (approx 6 months old) I do not
I know how to deal with it but am curious as to why it would behave differently...
any ideas?
|
|
|
|
|
If bin2file returns Nothing, you can't send it to UCase.
The code apparently doesn't check to see if rs is an actual recordset instead of Nothing.
It also doesn't check to see if a valid value is returned by rs!bin2File, instead of Nothing.
Try this and watch what happens: UCase(Nothing)
|
|
|
|
|
I understand what you are saying, but the question is why would it let me get away with it in a previous version of the program?
|
|
|
|
|
Because VB6 and VB.Net are totally different technologies and strings are handled differently since they are treated as immutable objects.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
|
I would check to see what's comming back from the database. If the app has hardcoded SQL in it, that may have changed in the new version, breaking the data that's coming back from the database.
|
|
|
|
|
Thanks, but it is indeed a null in both cases. Just an error in one and not the other
|
|
|
|
|
Null or Nullstring ""?
If UCase("" & rs!bin2File) = "CALLEDFROMDIAG" Then
|
|
|
|
|
I have set the max and min dates for the DateTimePicker.
When the program runs and the user tries to pick a date beyond the range, the computer "beeps".
Where/how can I put a msgbox() in there to indicate they are out of range?
I using VB.net 9
Thanks.
|
|
|
|
|
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged<br />
Dim Datebefore As Date<br />
Dim DateAfter As Date<br />
Dim DatePicked As Date<br />
<br />
Datebefore = ("01/01/2009")<br />
DateAfter = ("31/12/2009")<br />
<br />
DatePicked = DateTimePicker1.Value<br />
<br />
If DatePicked > DateAfter Or DatePicked < Datebefore Then<br />
MsgBox("Date Not Allowed", MsgBoxStyle.OkOnly)<br />
<br />
End If<br />
<br />
End Sub
Something like This?
Actually as I look at it I think you will need to put some kind of stop in there, I think it will loop, but I am sure you can manage that.
------------------------------------
"Possessions make you poor, wealth is measurable only in experience."
Sun Tzu 621BC
|
|
|
|
|
The DateTimePicker does not let the user pick a date before or after the MAX/MIN values I set in the DateTimePicker method. It responds with a "beep".
Therefor there is no value being reported back to the sub. Until a valid date is picked.
This code shows that.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DateTimePicker1.MaxDate = Today
DateTimePicker1.MinDate = "5/1/09"
End Sub
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
TextBox1.Text = DateTimePicker1.Value
End Sub
I know the system is reporting the attempt to pick a invalid date, because of the beep I hear.
So instead of just a beep, how can I get a MSGBOX()?
|
|
|
|
|
Have you done a Try/Catch as Exception?
------------------------------------
"Possessions make you poor, wealth is measurable only in experience."
Sun Tzu 621BC
|
|
|
|
|
There is no event that is raised by the control when an invalid date is attempted. Your code will never know that the user made such an attempt.
|
|
|
|
|
Thanks for the information.
|
|
|
|
|
I saw his code and thought it looked odd but couldn't see it!
My simple scribblings should be usable for him though, bending it to his needs of course, but I see the point about no event. But, if he is getting an Error Beep, is there no way to interupt at that point?
(Forgive my dimness, I am still learning )
------------------------------------
"Possessions make you poor, wealth is measurable only in experience."
Sun Tzu 621BC
|
|
|
|
|
How is your code going to know that it even happened?
|
|
|
|
|
I got you!
It only evaluates what has been picked AFTER it is selected, not whilst!
------------------------------------
"Possessions make you poor, wealth is measurable only in experience."
Sun Tzu 621BC
|
|
|
|
|
Yep!
|
|
|
|
|
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..!
|
|
|
|
|
Your code is very confusing as you have variables named the same but at different levels. It would be easier to find the problem if you would have just one main variable for the filestream, one for the image byte array. Use if statements to determine which file you want to load, then when you've done all the checks you can have just one spot that actually uses the filestream reader code.
You might also want to try using this instead of your filestreamreader code to convert the file into a byte array:
If FileIO.FileSystem.FileExists(s) Then
System.IO.File.ReadAllBytes(s)
End If
Also, is there a reason you make a copy of the datatable to send in, instead of just sending dt?
Hope this helps.
|
|
|
|
|
I'm trying to come up with a procedure to send sms alerts when certain things happen in my VB6 application(e.g when a scheduled job crashes).
Not exactly sure where to start, i've read a few articles on the net but they confusing me. I just want 2 know first in plain english what are the important things to consider, pc configurations, etc, before getting deep on the VB6 commands to achieve this(if there is).
I do not want to connect each and every sms recipient to my PC. Is this possible?
Thanks
|
|
|
|