|
Hi,
I have this code. Which is the beginning of class. The last line
objSI = new TBRSendDocInfo
has an error when this code
executes objSI is nothing.
What would cause a object not be able to instantiate it???
The object TBRSendDocInfo definition is below this code.
<transaction(transactionoption.requiresnew)> Public Class TransTimesheetWeekly
Inherits ServicedComponent
Public objSI As TBRSendDocInfo
Private CapType As String
Private CapID As Integer
Private justTimesheet As Boolean
Private SickDefault As Date = "01/01/1980"
Private HolidayDefault As Date = "01/01/1981"
Private LWOPDefault As Date = "01/01/1982"
Private Const WorkedDefault As String = "01/01/1984"
Private Const NotWorkedDefault As String = "01/01/1985"
Public Function ProcessTimesheetWeekly(ByVal tswID As Integer) As Integer
objSD = clsServiceDefaults.Load("C:\Windows\TBRServices.xml", GetType(clsServiceDefaults))
Connstr = objSD.TBRConnCap
WebConnstr = objSD.TBRWebConnCap
gTestEmail = objSD.TestEmailCap
Dim objCI As New tblCapturedInvoices(mdsDatabaseV3.mdsDbType.dbSQL)
Dim objTW As New tblwebTimesheetWeekly(mdsDatabaseV3.mdsDbType.dbSQL)
Dim objDB As New mdsDatabaseV3.cMDSTableData(Connstr, mdsDatabaseV3.mdsDbType.dbSQL)
Dim objWDB As New mdsDatabaseV3.cMDSTableData(WebConnstr, mdsDatabaseV3.mdsDbType.dbSQL)
Dim objDR As SqlClient.SqlDataReader
Dim objPR As SqlClient.SqlDataReader
Dim SQL, s As String
Dim i, j, wk, newID, wksInv As Integer
Dim objR As DataRow
Dim submitted As Date
Try
objSI = New TBRSendDocInfo
etc
etc
Imports System.Xml.Serialization
Imports System.IO
Public Class PDFDocInfo
Public InputFile As String
Public DocType As String
Public OutputFile As String
End Class
Public Class TBRSendDocInfo
Public ID As Integer
Public FirstName As String
Public LastName As String
Public Email As String
Public RecipientName As String
Public Subject As String
Public Body As String
Public LesterUser As String
Public FromEmail As String
<xmlignore()> Public PDFDocs As New ArrayList
Public Sub AddPDFDocInfo(ByVal pdfinfo As PDFDocInfo)
PDFDocs.Add(pdfinfo)
End Sub
Public Function AddNewPDFDocInfo() As PDFDocInfo
Dim newPDFDocInfo As New PDFDocInfo
PDFDocs.Add(newPDFDocInfo)
Return newPDFDocInfo
End Function
Public Property SendPDFDocs() As PDFDocInfo()
Get
Dim numPDFDocs As Integer
If PDFDocs.Count = 0 Then
numPDFDocs = 0
Else
numPDFDocs = PDFDocs.Count - 1
End If
Dim PDFDocInfoArray(numPDFDocs) As PDFDocInfo
PDFDocs.CopyTo(PDFDocInfoArray)
Return PDFDocInfoArray
End Get
Set(ByVal Value As PDFDocInfo())
PDFDocs.Clear()
If Not Value Is Nothing Then
Dim PDFDocInfo As PDFDocInfo
For Each PDFDocInfo In Value
PDFDocs.Add(PDFDocInfo)
Next
End If
End Set
End Property
Public Function Save(ByVal filename As String)
Dim tempFilename As String
tempFilename = filename & ".tmp"
Dim tempFileInfo As New FileInfo(tempFilename)
If tempFileInfo.Exists = True Then tempFileInfo.Delete()
Dim stream As New FileStream(tempFilename, FileMode.Create)
Try
Save(stream)
stream.Close()
tempFileInfo.CopyTo(filename, True)
tempFileInfo.Delete()
Catch ex As Exception
MsgBox("Error on Save of file " & filename & ". " & vbCrLf & ex.Message)
End Try
End Function
Public Function Save(ByVal stream As Stream)
Dim serializer As New XmlSerializer(Me.GetType)
serializer.Serialize(stream, Me)
End Function
Public Shared Function Load(ByVal filename As String, ByVal newType As Type) As Object
Dim fileInfo As New FileInfo(filename)
If fileInfo.Exists = False Then
Return System.Activator.CreateInstance(newType)
End If
Dim stream As New FileStream(filename, FileMode.Open)
Dim newObject As Object = Load(stream, newType)
stream.Close()
Return newObject
End Function
Public Shared Function Load(ByVal stream As Stream, ByVal newType As Type) As Object
Dim serializer As New XmlSerializer(newType)
Dim newObject As Object = serializer.Deserialize(stream)
Return newObject
End Function
End Class
|
|
|
|
|
You should post only relavent code. No one is going to take the time to read all that. Post only relavent lines, and also include the full, detailed error message you are getting. Without both of those things being done, your chances of getting helped are slim.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
In vb 6.0 we can use adodc by using connectionstring and recordsource properties and we can use that datasource and datafield properties to bind the controls with adodc.
But in vb.net there is no property to bind controls with adodc control.In vb.net we can only use databinding.add method to bind the controls but it does not allow to bind control with the adodc control.
Any idea how I can use adodc in vb.net 2005?
Thanks in advance
Ejaz
|
|
|
|
|
I suggest you look into OLEDB as a datalayer option, I beleive the datacontrol idea has been deprecated in .net
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks Holmes for the reply.
I never use oledb as data layer.Any artical or sample for this?
Ejaz
|
|
|
|
|
|
Adodc is not used anymore.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
haw im using control.invoke and why?
|
|
|
|
|
What is your question? It makes absolutely no sense.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
plz can someone try to help me how i can use DataGrid with dataset????
voila mon msn
cheikh_arabe@hotmail.com
|
|
|
|
|
Well it sort of depend on what you want to do, what platform you are using and a little more information tha you supplied.
I suggest searching as your first step, then try reading, then try and if you are still stuck ask an intelligent ?
use the search at the top of the page[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Have you ever heard of google? Do a search there and you'll find a wealth of information
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I am working with VB6 looking at an Access 97 database. What I am doing is converting VB5 code to VB6. I have come across a problem where the code creates a Query in the Access file, then assigns that query to a Recordset (I know the query is fine because when I run open it in Access it shows the desired results). The problem is with some DSum, DMin, and DMax statements in the Query. It assigns the Query to the Recordset with no problem (.Data1.RecordSource = "SELECT qryJCDSSchedLU1.* FROM qryJCDSSchedLU1 ") but then it runs a refresh (.Data1.Refresh) and then this gives an error. (Error – 3085 DOA. Database – Undefined function ‘DSUM’ in expression.) If I remove the DSum then it gives me this error on the DMin, and if I remove that it gives me the error on the DMax.
This works just fine in VB5 but not in VB6. Can anyone give me any suggestions on what I need to do to fix this? Thanks in advance for any help that you can give.
modified on Thursday, January 31, 2008 3:21:19 PM
|
|
|
|
|
And here I thought we were using cutting edge technology. The temptation to be rude is sooo strong but I'll refrain.
You are upgradeing from 5 to a product that is already retired and no longer supported. Why not move straight to .net you would get a lot more support and resources would be current.
Take the opportunity to rewrite the app, upgrade your skills, produce a BETTER solution.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am sorry I thought this form said Visual Basic / VB.Net which I thought meant that you could post any questions in here regarding Visual Basic. Can someone help me with the question that I posted? This is probably a very easy answer that others have come across in the past and know exactly how to handle it.
I don't understand what drives some people to waste their time by going in and out of forums making stupid comments and judging others instead of helping that person with the situation at hand (do you really have to try and make others feel bad to make yourself feel better?). I don't think I have to justify the reason that I am converting to VB6 or what I plan to do with this code once it is in VB6.
Mycroft Holmes wrote: The temptation to be rude is sooo strong but I'll refrain.
...right back at ya buddy!
|
|
|
|
|
I don't have a problem with using the old stuff, but he is right in one sense. VB6 has been "officially" dead for over a year now. DAO (not DOA) has been dead for about 8 years now, I think. That being said, your support resources out on the web are dwindling fast.
This[^] is about the best you're going to get.
|
|
|
|
|
Yes I agree that VB6 is "officially' dead. And I have no less than 3 other programs that are written in VB.net 2005. But for this project I have to convert it to VB6 before I can more forward to .Net and I have it at least 90 percent converted but there are several places in this code that uses the scenario that I presented in my question. That is why I am asking for help.
|
|
|
|
|
I would think you will have to rewrite the query in Access to duplicate the results, I would guess that DSum is an Access specific function that is no longer supported by the later version of DOA.
And yes the forum is for VB and you are correct to ask the ? here, however it stikes me as invalid to move from 5 to 6 before moving to .net, a waste of resources. I just hope it is not so you can use the upgrade wizard to get the app into .net!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I have Erorr message when I receving data on the net in tcpclient
in pocket pc .
I want to ask how Im receiving data on the net when i client pocket pc?
Sample Code maybe help
Thanks'
|
|
|
|
|
Agbaria Ahmed wrote: Erorr message when I receving data on the net in tcpclient
in pocket pc .
What kind of error message? Just saying you have an error message and not telling anyone what it says, really isn't going to have anyone help you at all.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
I have textbox where I am showing the date and the format of this date is short date "01/01/2008".I have a variable called mDeliveryDate as date and I want to stroe the textbox date in Variable with the format "01-Jan-2008" for which I am using the following statement
mDeliveryDate = Format(txtdate.text,"dd-MMM-yyyy")
I am getting error something like conversion from string to date is invalid.
Any idea how to fix this.
Thanks in Advance
Ejaz
|
|
|
|
|
Ejaz
Defining mDeliveryDate as Date means it is stored in the system date format, not a string.
The format is done later.
DateTime.TryParse(txtdate.text, mDeliveryDate )<br />
Dim longDate As String = mDeliveryDate.ToString("dd-MMM-yyyy")
will give you "01-Jan-2008" in longDate. If it is an invalid date it will give you DateTime.MinValue (01-Jan-0001)
Hope this helps
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Thanks Bob I will try this.
|
|
|
|
|
i am using dotnet2005.i do my project in vb.net windows application.
i want to display amount as 12,34,567.00 in crystal report.
in my project,amount is displayed as 1,234,567.00 in crystal report.
displayed as 1,234,567.00 is wrong,displayed as 12,34,567.00 is correct.
so how to displayed as 12,34,567.00 in crystal report.
there is any options in crystalreport to displayed as 12,34,567.00.
no option means,can solve this problem using vb.net code.
|
|
|
|
|
First - this is a CR problem and so no VB-code will help you.
But you can provide format options for your fields in CR - try looking there (I think there might be a way).
If not you can create a formula-field in CR (it provides a own CR and even a Basic syntax) and format a number just like you would do it in plain VB.
If you don't manage this your last option is to use a character-field for the number and format it in VB before sending the data to the crystal report.
|
|
|
|