Home All Groups Group Topic Archive Search About

Argument not specified

Author
19 Jul 2006 2:07 PM
CrashGirl
Anybody have an idea on what i am doing wrong here,

CheckSetService    - Argument not specified for parameter 'Tipo' of
'Private Sub CheckSetService(Tipo As Long)'.

    Private Sub btnStartService_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnStartService.Click
        CheckSetService(1)
    End Sub

    Private Sub btnStopService_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnStopService.Click
        CheckSetService(2)

Author
19 Jul 2006 2:15 PM
tommaso.gastaldi
Try with 1L, 2L, or use an integer arg.

-tom

CrashGirl ha scritto:

Show quoteHide quote
> Anybody have an idea on what i am doing wrong here,
>
> CheckSetService    - Argument not specified for parameter 'Tipo' of
> 'Private Sub CheckSetService(Tipo As Long)'.
>
>     Private Sub btnStartService_Click(ByVal sender As System.Object,
> ByVal e As System.EventArgs) Handles btnStartService.Click
>         CheckSetService(1)
>     End Sub
>
>     Private Sub btnStopService_Click(ByVal sender As System.Object,
> ByVal e As System.EventArgs) Handles btnStopService.Click
>         CheckSetService(2)
Author
19 Jul 2006 6:31 PM
CrashGirl
Hi,

I tried but not worked... :( and I have other problem... with this
"object reference not set to an instance of an object" anyone knows
what´s the problem?

tommaso.gasta***@uniroma1.it escreveu:

Show quoteHide quote
> Try with 1L, 2L, or use an integer arg.
>
> -tom
>
> CrashGirl ha scritto:
>
> > Anybody have an idea on what i am doing wrong here,
> >
> > CheckSetService    - Argument not specified for parameter 'Tipo' of
> > 'Private Sub CheckSetService(Tipo As Long)'.
> >
> >     Private Sub btnStartService_Click(ByVal sender As System.Object,
> > ByVal e As System.EventArgs) Handles btnStartService.Click
> >         CheckSetService(1)
> >     End Sub
> >
> >     Private Sub btnStopService_Click(ByVal sender As System.Object,
> > ByVal e As System.EventArgs) Handles btnStopService.Click
> >         CheckSetService(2)
Author
19 Jul 2006 9:26 PM
tommaso.gastaldi
yes, CG that is the generic message you get when trying to use an
object which you have not instantiated yet. You will see it some
million times in your life if you keep programming... :) although the
new IDE try to warn when possible

Post the code, otherwise nobody is able to help you ...

-t

CrashGirl ha scritto:

Show quoteHide quote
> Hi,
>
> I tried but not worked... :( and I have other problem... with this
> "object reference not set to an instance of an object" anyone knows
> what´s the problem?
>
> tommaso.gasta***@uniroma1.it escreveu:
>
> > Try with 1L, 2L, or use an integer arg.
> >
> > -tom
> >
> > CrashGirl ha scritto:
> >
> > > Anybody have an idea on what i am doing wrong here,
> > >
> > > CheckSetService    - Argument not specified for parameter 'Tipo' of
> > > 'Private Sub CheckSetService(Tipo As Long)'.
> > >
> > >     Private Sub btnStartService_Click(ByVal sender As System.Object,
> > > ByVal e As System.EventArgs) Handles btnStartService.Click
> > >         CheckSetService(1)
> > >     End Sub
> > >
> > >     Private Sub btnStopService_Click(ByVal sender As System.Object,
> > > ByVal e As System.EventArgs) Handles btnStopService.Click
> > >         CheckSetService(2)
Author
20 Jul 2006 2:42 AM
Cor Ligthert [MVP]
CrashGirl

As you show us code, than please show it at least well.
> 'Private Sub CheckSetService(Tipo As Long)'.

Are you sure that this is exactly as this in your code?

Cor
Author
20 Jul 2006 2:05 PM
CrashGirl
hi Guys, here is my code...

Private Sub btnStartService_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnStartService.Click
        CheckSetService(1)
    End Sub

    Private Sub btnStopService_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnStopService.Click
        CheckSetService(2)
    End Sub

    Private Sub CheckSetService(ByVal Tipo As Long)
        Dim Svc As ServiceProcess.ServiceController
        Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
        Svc = New ServiceProcess.ServiceController
        Svc.ServiceName = "SWFTPClient"
        Svc.Refresh()
        Select Case Tipo
            Case 1
                Try
                    If
Svc.Status.Equals(ServiceProcess.ServiceControllerStatus.Stopped) Then
                        Me.sBar.Text = "Iniciando o serviço !
Aguarde..."
                        Svc.Start()
                        Svc.Refresh()
                    End If
                Catch ex As Exception
                End Try
            Case 2
                Try
                    If
Svc.Status.Equals(ServiceProcess.ServiceControllerStatus.Running) Then
                        Me.sBar.Text = "Parando o serviço !
Aguarde..."
                        Svc.Stop()
                        Svc.Refresh()
                    End If
                Catch ex As Exception
                End Try
        End Select
        Try
            Select Case Tipo
                Case 1

Svc.WaitForStatus(ServiceProcess.ServiceControllerStatus.Running,
System.TimeSpan.FromSeconds(30))
                Case 2

Svc.WaitForStatus(ServiceProcess.ServiceControllerStatus.Stopped,
System.TimeSpan.FromSeconds(30))
            End Select
        Catch ex As Exception
            Svc.Refresh()
        End Try
        Try
            Me.lblStatusSvc.Text = "SWFTPClient Service: " &
Svc.Status.ToString
            If
Svc.Status.Equals(ServiceProcess.ServiceControllerStatus.Stopped) Then
                Me.btnStartService.Enabled = True
                Me.btnStopService.Enabled = False
            ElseIf
Svc.Status.Equals(ServiceProcess.ServiceControllerStatus.Running) Then
                Me.btnStartService.Enabled = False
                Me.btnStopService.Enabled = True
            End If
        Catch ex As Exception
            Me.lblStatusSvc.Text = "SWFTPClient Service: Indisponível"
            Me.btnStartService.Enabled = False
            Me.btnStopService.Enabled = False
        End Try
        Me.sBar.Text = ""
        Me.Cursor = System.Windows.Forms.Cursors.Default

When I click button start to service my file log register ("Object
reference
not set to an instance of an object")
Only when i start my service...
Author
20 Jul 2006 3:51 PM
Cor Ligthert [MVP]
CrashGirl,

I see 4 times Tipo, where is it giving the error?
(Although I do not see the sense why it is long while integer is the most
sufficient numeric value or here even Boolean can be used).

Cor

"CrashGirl" <puk***@gmail.com> schreef in bericht
news:1153404330.404023.79510@s13g2000cwa.googlegroups.com...
hi Guys, here is my code...

Private Sub btnStartService_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles btnStartService.Click
        CheckSetService(1)
    End Sub

    Private Sub btnStopService_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnStopService.Click
        CheckSetService(2)
    End Sub

    Private Sub CheckSetService(ByVal Tipo As Long)
        Dim Svc As ServiceProcess.ServiceController
        Me.Cursor = System.Windows.Forms.Cursors.WaitCursor
        Svc = New ServiceProcess.ServiceController
        Svc.ServiceName = "SWFTPClient"
        Svc.Refresh()
        Select Case Tipo
            Case 1
                Try
                    If
Svc.Status.Equals(ServiceProcess.ServiceControllerStatus.Stopped) Then
                        Me.sBar.Text = "Iniciando o serviço !
Aguarde..."
                        Svc.Start()
                        Svc.Refresh()
                    End If
                Catch ex As Exception
                End Try
            Case 2
                Try
                    If
Svc.Status.Equals(ServiceProcess.ServiceControllerStatus.Running) Then
                        Me.sBar.Text = "Parando o serviço !
Aguarde..."
                        Svc.Stop()
                        Svc.Refresh()
                    End If
                Catch ex As Exception
                End Try
        End Select
        Try
            Select Case Tipo
                Case 1

Svc.WaitForStatus(ServiceProcess.ServiceControllerStatus.Running,
System.TimeSpan.FromSeconds(30))
                Case 2

Svc.WaitForStatus(ServiceProcess.ServiceControllerStatus.Stopped,
System.TimeSpan.FromSeconds(30))
            End Select
        Catch ex As Exception
            Svc.Refresh()
        End Try
        Try
            Me.lblStatusSvc.Text = "SWFTPClient Service: " &
Svc.Status.ToString
            If
Svc.Status.Equals(ServiceProcess.ServiceControllerStatus.Stopped) Then
                Me.btnStartService.Enabled = True
                Me.btnStopService.Enabled = False
            ElseIf
Svc.Status.Equals(ServiceProcess.ServiceControllerStatus.Running) Then
                Me.btnStartService.Enabled = False
                Me.btnStopService.Enabled = True
            End If
        Catch ex As Exception
            Me.lblStatusSvc.Text = "SWFTPClient Service: Indisponível"
            Me.btnStartService.Enabled = False
            Me.btnStopService.Enabled = False
        End Try
        Me.sBar.Text = ""
        Me.Cursor = System.Windows.Forms.Cursors.Default

When I click button start to service my file log register ("Object
reference
not set to an instance of an object")
Only when i start my service...