Argument not specified

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • CrashGirl

    #1

    Argument not specified

    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.EventArg s) Handles btnStartService .Click
    CheckSetService (1)
    End Sub

    Private Sub btnStopService_ Click(ByVal sender As System.Object,
    ByVal e As System.EventArg s) Handles btnStopService. Click
    CheckSetService (2)

  • tommaso.gastaldi@uniroma1.it

    #2
    Re: Argument not specified

    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.EventArg s) Handles btnStartService .Click
    CheckSetService (1)
    End Sub
    >
    Private Sub btnStopService_ Click(ByVal sender As System.Object,
    ByVal e As System.EventArg s) Handles btnStopService. Click
    CheckSetService (2)

    Comment

    • CrashGirl

      #3
      Re: Argument not specified

      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.gastald i@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.EventArg s) Handles btnStartService .Click
      CheckSetService (1)
      End Sub

      Private Sub btnStopService_ Click(ByVal sender As System.Object,
      ByVal e As System.EventArg s) Handles btnStopService. Click
      CheckSetService (2)

      Comment

      • tommaso.gastaldi@uniroma1.it

        #4
        Re: Argument not specified

        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:
        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.gastald i@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.EventArg s) Handles btnStartService .Click
        CheckSetService (1)
        End Sub
        >
        Private Sub btnStopService_ Click(ByVal sender As System.Object,
        ByVal e As System.EventArg s) Handles btnStopService. Click
        CheckSetService (2)

        Comment

        • Cor Ligthert [MVP]

          #5
          Re: Argument not specified

          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


          Comment

          • CrashGirl

            #6
            Re: Argument not specified

            hi Guys, here is my code...

            Private Sub btnStartService _Click(ByVal sender As System.Object, ByVal
            e As System.EventArg s) Handles btnStartService .Click
            CheckSetService (1)
            End Sub

            Private Sub btnStopService_ Click(ByVal sender As System.Object,
            ByVal e As System.EventArg s) Handles btnStopService. Click
            CheckSetService (2)
            End Sub

            Private Sub CheckSetService (ByVal Tipo As Long)
            Dim Svc As ServiceProcess. ServiceControll er
            Me.Cursor = System.Windows. Forms.Cursors.W aitCursor
            Svc = New ServiceProcess. ServiceControll er
            Svc.ServiceName = "SWFTPClien t"
            Svc.Refresh()
            Select Case Tipo
            Case 1
            Try
            If
            Svc.Status.Equa ls(ServiceProce ss.ServiceContr ollerStatus.Sto pped) 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.Equa ls(ServiceProce ss.ServiceContr ollerStatus.Run ning) 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.WaitForStat us(ServiceProce ss.ServiceContr ollerStatus.Run ning,
            System.TimeSpan .FromSeconds(30 ))
            Case 2

            Svc.WaitForStat us(ServiceProce ss.ServiceContr ollerStatus.Sto pped,
            System.TimeSpan .FromSeconds(30 ))
            End Select
            Catch ex As Exception
            Svc.Refresh()
            End Try
            Try
            Me.lblStatusSvc .Text = "SWFTPClien t Service: " &
            Svc.Status.ToSt ring
            If
            Svc.Status.Equa ls(ServiceProce ss.ServiceContr ollerStatus.Sto pped) Then
            Me.btnStartServ ice.Enabled = True
            Me.btnStopServi ce.Enabled = False
            ElseIf
            Svc.Status.Equa ls(ServiceProce ss.ServiceContr ollerStatus.Run ning) Then
            Me.btnStartServ ice.Enabled = False
            Me.btnStopServi ce.Enabled = True
            End If
            Catch ex As Exception
            Me.lblStatusSvc .Text = "SWFTPClien t Service: Indisponível"
            Me.btnStartServ ice.Enabled = False
            Me.btnStopServi ce.Enabled = False
            End Try
            Me.sBar.Text = ""
            Me.Cursor = System.Windows. Forms.Cursors.D efault

            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...

            Comment

            • Cor Ligthert [MVP]

              #7
              Re: Argument not specified

              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" <pukuna@gmail.c omschreef in bericht
              news:1153404330 .404023.79510@s 13g2000cwa.goog legroups.com...
              hi Guys, here is my code...

              Private Sub btnStartService _Click(ByVal sender As System.Object, ByVal
              e As System.EventArg s) Handles btnStartService .Click
              CheckSetService (1)
              End Sub

              Private Sub btnStopService_ Click(ByVal sender As System.Object,
              ByVal e As System.EventArg s) Handles btnStopService. Click
              CheckSetService (2)
              End Sub

              Private Sub CheckSetService (ByVal Tipo As Long)
              Dim Svc As ServiceProcess. ServiceControll er
              Me.Cursor = System.Windows. Forms.Cursors.W aitCursor
              Svc = New ServiceProcess. ServiceControll er
              Svc.ServiceName = "SWFTPClien t"
              Svc.Refresh()
              Select Case Tipo
              Case 1
              Try
              If
              Svc.Status.Equa ls(ServiceProce ss.ServiceContr ollerStatus.Sto pped) 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.Equa ls(ServiceProce ss.ServiceContr ollerStatus.Run ning) 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.WaitForStat us(ServiceProce ss.ServiceContr ollerStatus.Run ning,
              System.TimeSpan .FromSeconds(30 ))
              Case 2

              Svc.WaitForStat us(ServiceProce ss.ServiceContr ollerStatus.Sto pped,
              System.TimeSpan .FromSeconds(30 ))
              End Select
              Catch ex As Exception
              Svc.Refresh()
              End Try
              Try
              Me.lblStatusSvc .Text = "SWFTPClien t Service: " &
              Svc.Status.ToSt ring
              If
              Svc.Status.Equa ls(ServiceProce ss.ServiceContr ollerStatus.Sto pped) Then
              Me.btnStartServ ice.Enabled = True
              Me.btnStopServi ce.Enabled = False
              ElseIf
              Svc.Status.Equa ls(ServiceProce ss.ServiceContr ollerStatus.Run ning) Then
              Me.btnStartServ ice.Enabled = False
              Me.btnStopServi ce.Enabled = True
              End If
              Catch ex As Exception
              Me.lblStatusSvc .Text = "SWFTPClien t Service: Indisponível"
              Me.btnStartServ ice.Enabled = False
              Me.btnStopServi ce.Enabled = False
              End Try
              Me.sBar.Text = ""
              Me.Cursor = System.Windows. Forms.Cursors.D efault

              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...


              Comment

              Working...