|
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
|
|
|
|
|
Instead of fooling around with gateways and such, I think you could send an email to the phonenumber@provider and it will get sent to the phone, albeit this was an old tactic I used (mine was 514*******@pcs.rogers.com), or configure your email account on your phone and just send an email to that address assuming your phone can support email accounts.
|
|
|
|
|
Dear all,
I have a crystal report which has a lot of detaildections. In 3 sections there are 3 subreports. (1 subreport per section).
If there is no data available I would like to hide the section. This works perfectly for the no subreport sections.
It also works perfectly if there is no data in the whole subreport.
However in some cases the subreport also has section and if there is not data for that one particular section I would like to hide it. I can do this, but then it hides that section for all records in that subreport. I only want it for that specific section.
I hope that makes sense. If you need more info please ask.
My code is as follows:
Do While Not rs.EOF
bFound = True
With dsCVForClient
.dtPersonalDetails.Rows.Add(rs.Fields(0).Value, rs.Fields(1).Value, rs.Fields(2).Value, rs.Fields(3).Value, rs.Fields(4).Value, rs.Fields(5).Value, rs.Fields(6).Value, rs.Fields(7).Value, rs.Fields(8).Value, rs.Fields(9).Value, rs.Fields(10).Value, rs.Fields(11).Value, rs.Fields(12).Value, rs.Fields(13).Value, rs.Fields(14).Value, rs.Fields(15).Value, rs.Fields(16).Value, rs.Fields(17).Value, rs.Fields(18).Value, rs.Fields(19).Value, rs.Fields(20).Value, rs.Fields(21).Value, rs.Fields(22).Value, rs.Fields(23).Value, rs.Fields(24).Value, sClient, sVacancy, sConsultant)
rsInHouse = gCnn.Execute("select regno, tertiaryinstitute, course, duration, completed, subjects from tertiaryeducation where regno = '" & sRegNo & "'")
Do While Not rsInHouse.EOF
For i = 0 To 5
If rsInHouse.Fields(i).Value = "" Then sTertiaryEducation(i) = "Not specified" Else sTertiaryEducation(i) = rsInHouse.Fields(i).Value
Next
.dtInHouseOtherCourses.Rows.Add(sTertiaryEducation(0), sTertiaryEducation(1), sTertiaryEducation(2), sTertiaryEducation(3), sTertiaryEducation(4), sTertiaryEducation(5))
rsInHouse.MoveNext()
Loop
rsJobHistory = gCnn.Execute("select regno, company, jobtitle, datestarted, dateleft, tasks, reasonleft, duties from jobhistory where regno = '" & sRegNo & "' order by datestarted DESC")
Do While Not rsJobHistory.EOF
For i = 0 To 6
If rsJobHistory.Fields(i).Value = "" Then sJobHistory(i) = "Not specified" Else sJobHistory(i) = rsJobHistory.Fields(i).Value
Next
If rsJobHistory.Fields(7).Value <> "" Then
If sJobHistory(4) = "0000-00-00" Then .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to current" & vbCrLf & vbCrLf & rsJobHistory.Fields(7).Value, sJobHistory(5), sJobHistory(6)) Else .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to " & sJobHistory(4) & vbCrLf & vbCrLf & rsJobHistory.Fields(7).Value, sJobHistory(5), sJobHistory(6))
Else
If sJobHistory(4) = "0000-00-00" Then .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to current", sJobHistory(5), sJobHistory(6)) Else .dtJobHistory.Rows.Add(sJobHistory(0), sJobHistory(1), sJobHistory(2), sJobHistory(3) & " to " & sJobHistory(4), sJobHistory(5), sJobHistory(6))
End If
rsJobHistory.MoveNext()
Loop
rsReferences = gCnn.Execute("select regno, nameofreference, designation, refcompany, reftelephone, refcellphone, reportedto, verifydates, closelysupervised, supervisestaff, nostaff, howwell, relsubordinates, relcolleagues, relsuperiors, relcustomers, meetobjectives, handlepressure, accuracy, reliability, honest, honestreporting, comparitiveresults, refstrengths, refweaknesses, attendance, reason, specificskills, rehire, refspecialachievements, otherinformation, comments from refercheck where regno = '" & sRegNo & "'")
Do While Not rsReferences.EOF
For i = 0 To 31
If rsReferences.Fields(i).Value = "" Then sReferences(i) = "Not specified" Else sReferences(i) = rsReferences.Fields(i).Value
Next
If sReferences(7) = "1" Then sReferences(7) = "Yes" Else sReferences(7) = "No"
If sReferences(9) = "1" Then sReferences(9) = "Yes" Else sReferences(9) = "No"
.dtReferences.Rows.Add(sReferences(0), sReferences(1), sReferences(2), sReferences(3), sReferences(4), sReferences(5), sReferences(6), sReferences(7), sReferences(8), sReferences(9), sReferences(10), sReferences(11), sReferences(12), sReferences(13), sReferences(14), sReferences(15), sReferences(16), sReferences(17), sReferences(18), sReferences(19), sReferences(20), sReferences(21), sReferences(22), sReferences(23), sReferences(24), sReferences(25), sReferences(26), sReferences(27), sReferences(28), sReferences(29), sReferences(30), sReferences(31))
rsReferences.MoveNext()
Loop
End With
rs.MoveNext()
Loop
Many thanks
Andrew
|
|
|
|
|
What logic are you using to hide/unhide the section ?
I just don't see it.
You have to remember that when you create a "Supression" formula in Crystal, you have to make sure that you have logic to both hide (supress=true) and unhide (supress=false).
Regards,
David
|
|
|
|
|
Hi David,
Thank you for your reply.
Ok the reason you dont see it is becuase maybe my brain is on overload and I posted the section it populates the dataset. The reason being is I thought maybe it could be done there somewhere. But on second thought it cant be done there.
A short sample:
If dsCVForClient.dtPersonalDetails(0).ComputerPackages = "" Then rpt.DetailSection49.SectionFormat.EnableSuppress = True
If dsCVForClient.dtInHouseOtherCourses.Count = 0 Then rpt.DetailSection50.SectionFormat.EnableSuppress = True
To get to the subreport, i used:
rpt.Subreports(0).ReportDefinition.Sections(5).SectionFormat.EnableSuppress = True
But it led to the seciont being suppressed for all the records in the subreport.
The personaldetails will only ever have 1 record for this report, but the subreports could have anything from 0 to 100 records.
|
|
|
|
|
If appears that your logic sets the suppression to "TRUE", but never sets it to "FALSE".
I think the answer is to put an Else clause and set the suppression to FALSE.
give it a try.
|
|
|
|
|
Thank you, that was a great suggestion.
The bad news is though, it didnt work. What happens then is it enabled the section for all the records again. So if the last record did have a vaule in the field it unhid the section for all the records.
For i = 0 To dsCVForClient.dtInHouseOtherCourses.Count - 1
If dsCVForClient.dtInHouseOtherCourses(i).Subjects = "" Then rpt.Subreports(0).ReportDefinition.Sections(5).SectionFormat.EnableSuppress = True Else rpt.Subreports(0).ReportDefinition.Sections(5).SectionFormat.EnableSuppress = False
Next
I seem to think the secret lies in the rpt.Subreports(0).ReportDefinition is there some way to talk to a record in that subreport?
|
|
|
|
|
You can write a fomula to supress the "detail" section of the subreport, effectively suppressing the output for each record as you see fit.
|
|
|
|
|