|
craigmg78 wrote: Private Sub AddPayrollTable(ByVal TableCode As Integer, ByRef PayrollArray As String)
Well, I see a couple of problems. The first parameter is passed as an Integer with the name "*Code". This leads me to believe it should be an enum, but I'm saying this based on very limited information. Right now, you're passing a "magic number" that offers no documention about what it means.
The second parameter is not being passed an array, but as a single String. Initializing an array is really mean to be done by the caller, not the callee. But, again, you haven't provided any information as to what this method does with the array and what the contents of the array is supposed to be, so it's difficult to say what the correct solution is.
|
|
|
|
|
Hi,
assuming your code compiles fine and produces a run-time error "Object reference not set ..."
when it somewhere calls your sub AddPayrollTable(...) that really means the caller hasn't
allocated the object (string?) that is being passed as the second parameter.
Yes, it is the caller that needs to initialize the parameters it is passing to the callee;
the callee can only accept them any way they come.
BTW: the name implies it would be an array, but then it should say As String()
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Yes, I see now what the problem was thanks to Dave and Luc. I was calling the sub and passing an array to a string slot. Luc is correct, it should have said String(). Whoops. Thank you!
"That rug really tied the room together."
|
|
|
|
|
Unless you want to replace the entire array with another array, you should not send the parameter by reference. You can still change the items in the array when sending the parameter by value:
Private Sub AddPayrollTable(ByVal TableCode As Integer, ByVal PayrollArray As String())
However, you still have to create the array before calling the method.
If you want to create the array in the method, you should return the array from it:
Private Function GetPayrollTable(ByVal TableCode As Integer) As String()
If you want to add items to the collecion, it should be a list instead of an array:
Private Sub AddPayrollTable(ByVal TableCode As Integer, ByVal PayrollList As List(Of String))
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hello Everyone.
How is possible send a report with out the preview?
Is VB6 is possible but here? I dont know..
Any idea?
Just is case.. is was my source in VB6... BR
Dim strReportName As String
Dim intReportDestination As Integer
strReportName = "test.RPT"
With cr
.ReportFileName = "label.rpt"
.DataFiles(0) = "batabase.mdb"
.Destination = crptToPrinter
.PrinterName = Zebra
.Action = 1
End With
|
|
|
|
|
How check for framework version
|
|
|
|
|
|
You can write some bad code and browse to that page. The bottom of the error message will state the version of .NET that's in use.
For example[^]
Good luck.
Ranjit Viswakumar
Professional Services Specialist
http://hostmysite.com/?utm_source=bb
|
|
|
|
|
I'm assuming he's talking about find out which version the app is running under in his own code, not by crapping out an app and looking at the wreckage.
|
|
|
|
|
Hi, I'm trying to create one FTP automation using vb.net. Which is consist of the following requirement.
1) Downloading file (with specific file name)
2) Move the file at the FTP server to another directory
3) Uploading file
-All of the task need to be schedule at specific time and it's on daily basis.
Can someone help me on this matter.
|
|
|
|
|
You can start with the System.Net.FtpWebRequest[^] class to download files and rename them upload them. It exposes a basic FTP client in a class.
You'd probably write this as a Console application and schedule it to run using the Windows Scheduler
(Control Panel -> Scheduled Tasks).
|
|
|
|
|
I have implemented the IOleCommandTarget interface in a VB.NET 2005 Browser Helper Object. First, I wanted to share the code with everyone since it took me a while to get it working and I couldn't find any examples on the 'Net.
Now I want to be sure I know what to do with my new found toy. Specifically:
Do I need to output something from the Exec sub?
What do I output from the QueryStatus sub to answer Internet Explorer's interrogation?
Thanks! Here's the code:
Imports System
Imports System.Runtime.InteropServices
Namespace MyPopUpBHO
#Region "Interface Definition"
<structlayout(layoutkind.sequential,> _
Public Structure OLECMDTEXT
Public cmdtextf As UInt32
Public cwActual As UInt32
Public cwBuf As UInt32
Public rgwz As Char
End Structure
<structlayout(layoutkind.sequential)> _
Public Structure OLECMD
Public cmdID As UInt32
Public cmdf As UInt32
End Structure
' Interop definition for IOleCommandTarget.
<comimport(),> InterfaceType(ComInterfaceType.InterfaceIsIUnknown)> _
Public Interface IOleCommandTarget
Sub QueryStatus( _
ByRef pguidCmdGroup As Guid, _
ByVal cCmds As UInt32, _
<marshalas(unmanagedtype.lparray,> ByVal prgCmds() As OLECMD, _
ByRef pCmdText As OLECMDTEXT)
Sub Exec( _
ByRef pguidCmdGroup As Guid, _
ByVal nCmdId As Integer, _
ByVal nCmdExecOpt As Integer, _
ByRef pvaIn As IntPtr, _
<marshalas(unmanagedtype.sysint)> ByRef pvaOut As IntPtr)
End Interface
#End Regino
<guidattribute("b722bccb-4e68-101b-a2bc-00aa00404770")> _
Public Class ctvb
Implements IOleCommandTarget
Public Sub Exec( _
ByRef pguidCmdGroup As Guid, _
ByVal nCmdId As Integer, _
ByVal nCmdExecOpt As Integer, _
ByRef pvaIn As IntPtr, _
<marshalas(unmanagedtype.sysint)> ByRef pvaOut As IntPtr) Implements IOleCommandTarget.Exec
System.Windows.Forms.MessageBox.Show("Hiya Exec!")
End Sub
Public Sub QueryStatus(ByRef pguidCmdGroup As Guid, _
ByVal cCmds As UInt32, _
<marshalas(unmanagedtype.lparray,> ByVal prgCmds() As OLECMD, _
ByRef pCmdText As OLECMDTEXT) Implements IOleCommandTarget.QueryStatus
System.Windows.Forms.MessageBox.Show("Hiya QueryStatus!")
End Sub
End Class
End Namespace
|
|
|
|
|
David Seger wrote: Do I need to output something from the Exec sub?
This is the command that your code has to interpret and execute. Remember, your supplying the implementation of an interface that OLE is calling you with. This caommand can be executed in a seperate thread that your code sets up and starts. Any return value should be one of thoses documented here[^].
David Seger wrote: What do I output from the QueryStatus sub to answer Internet Explorer's interrogation?
This is normally filling in the status of the various commands you got in the Exec implementation. If your commands are still running, you update the status of those commands in the structures passed in from IE.
|
|
|
|
|
How do you format the date time to just date?
for example, this is what i retrievedd from the database: 12/31/2008 12:00:00 AM, but i just want to show the date and no time.
|
|
|
|
|
Hi Muhammad;
This will display the date only
' Simulate date and time from the DB
Dim dt As DateTime = Now
' This will display the date only
MessageBox.Show(dt.ToString("MM/dd/yyyy"))
Fernando
|
|
|
|
|
No need to ask the same question twice, but 7 minutes apart. If someone doesn't answer the first they ain't going to answer the second.
|
|
|
|
|
EliottA wrote: If someone doesn't answer the first they ain't going to answer the second.
I'm afraid Fernando has proven you're wrong about that...
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
fair enough. Point still stands..
|
|
|
|
|
I want to remove the time from (2/6/2009 12:00:00 AM ).
I want to use only date without displaying the time (in vb.net)
|
|
|
|
|
|
Or
dateOnly.ToShortDateString()
|
|
|
|
|
I am using VB.net 2009. How should I bring my form to front. Right now I am able to restrict the user to open the duplicate instance only. But the already opened instance remains minimized. So sometimes , it leads to the confusion that the form is not getting opened and Actually it is already opened in minimized window state. If i changes the window state to maximized. Then it changes the window state also, Because sometimes, the window is in normal mode and is minimized also / the window state us in maximized and minimized mode . How should I resolve this issue?
Dim objInv As frmWaste = Nothing
For i As Integer = 0 To My.Application.OpenForms.Count - 1
Select Case Filename
Case "frmAdd"
If (My.Application.OpenForms(i).Name = Filename) Then
objInv = My.Application.OpenForms(i)
If (objInv .UserID = id) Then
objInv .Focus()
Return True
End If
End If
End Select
Next
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
Before you set the Focus, try checking the WindowState and if it is minimised, set it to Normal.
Pankaj Garg wrote: if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
I have no idea!!!
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
There's no such thing as VB.NET 2009. It's 2002, 2003, 2005, or 2008... and soon to be 2010.
|
|
|
|
|
Sorry, I Meant 2008
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|