Help!

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

    Help!

    I need code example for: how many times number repeat in the list? It must
    be declared as:

    Public Function Find(L As ListBox, Number As Integer ) As Integer

    Sorry on my badly english, im from Croatia!
    P.S. I need this for exam!


  • Stephane Richard

    #2
    Re: Help!

    Hi Miro,

    Here it is.

    Public Function Find(L As ListBox, Number As Integer ) As Integer

    Dim WorkNumber As Integer
    Dim Counter As Integer

    WorkNumber = 0
    For Counter = 0 to L.ListCount
    If L.ListItem(Coun ter) = Number Then
    WorkNumber = WorkNumber + 1
    End If
    Next Counter
    Find = WorkNumber

    End Function

    --
    Stéphane Richard
    Senior Software and Technology Supervisor

    For all your hosting and related needs
    "Miro" <Miroslav.Ovani n@public.srce.h r> wrote in message
    news:ben0i0$qsd $1@bagan.srce.h r...[color=blue]
    > I need code example for: how many times number repeat in the list? It must
    > be declared as:
    >
    > Public Function Find(L As ListBox, Number As Integer ) As Integer
    >
    > Sorry on my badly english, im from Croatia!
    > P.S. I need this for exam!
    >
    >[/color]


    Comment

    • Rick Rothstein

      #3
      Re: Help!

      Stephane, I don't want you to take this wrong or anything, but .... are you
      nuts!. The man IS TAKING AN EXAM! I would think this is for a programming
      class and he can't figure out how to do this simple exercise. You come along
      and give him the code which he will in turn submit as his own work. He
      didn't learn anything and his teacher thinks he knows something. You didn't
      do the poster any real favor here; you just helped him cheat. We don't like
      to do people's homework (or answer their test question) for them.

      Usually, it is hard to tell that the poster is trying to get someone here to
      do their work for them; but, in this case, it was kind of easy to figure
      out.<g> For future reference, if a question seems to be for a homework
      assignment or test, ask the poster to show what he/she has tried; then point
      out where they have gone wrong (don't give them the answer though) and ask
      them to try again. He/she can always come back to the newsgroup with
      additional questions should he/she have any. Doing it this way, you will
      have actually helped the person to learn.

      Sorry about being so harsh with you, but this kind of thing is a pet peeve
      of mine.

      Rick - MVP


      "Stephane Richard" <stephane.richa rd@verizon.net> wrote in message
      news:4%DPa.600$ Kw1.411@nwrdny0 2.gnilink.net.. .[color=blue]
      > Hi Miro,
      >
      > Here it is.
      >
      > Public Function Find(L As ListBox, Number As Integer ) As Integer
      >
      > Dim WorkNumber As Integer
      > Dim Counter As Integer
      >
      > WorkNumber = 0
      > For Counter = 0 to L.ListCount
      > If L.ListItem(Coun ter) = Number Then
      > WorkNumber = WorkNumber + 1
      > End If
      > Next Counter
      > Find = WorkNumber
      >
      > End Function
      >
      > --
      > Stéphane Richard
      > Senior Software and Technology Supervisor
      > http://www.totalweb-inc.com
      > For all your hosting and related needs
      > "Miro" <Miroslav.Ovani n@public.srce.h r> wrote in message
      > news:ben0i0$qsd $1@bagan.srce.h r...[color=green]
      > > I need code example for: how many times number repeat in the list? It[/color][/color]
      must[color=blue][color=green]
      > > be declared as:
      > >
      > > Public Function Find(L As ListBox, Number As Integer ) As Integer
      > >
      > > Sorry on my badly english, im from Croatia!
      > > P.S. I need this for exam!
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Stephane Richard

        #4
        Re: Help!

        I understand...
        --
        Stéphane Richard
        Senior Software and Technology Supervisor

        For all your hosting and related needs


        "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote in message
        news:ptucnWfGfv 0N4oyiXTWJgA@co mcast.com...[color=blue]
        > Stephane, I don't want you to take this wrong or anything, but .... are[/color]
        you[color=blue]
        > nuts!. The man IS TAKING AN EXAM! I would think this is for a programming
        > class and he can't figure out how to do this simple exercise. You come[/color]
        along[color=blue]
        > and give him the code which he will in turn submit as his own work. He
        > didn't learn anything and his teacher thinks he knows something. You[/color]
        didn't[color=blue]
        > do the poster any real favor here; you just helped him cheat. We don't[/color]
        like[color=blue]
        > to do people's homework (or answer their test question) for them.
        >
        > Usually, it is hard to tell that the poster is trying to get someone here[/color]
        to[color=blue]
        > do their work for them; but, in this case, it was kind of easy to figure
        > out.<g> For future reference, if a question seems to be for a homework
        > assignment or test, ask the poster to show what he/she has tried; then[/color]
        point[color=blue]
        > out where they have gone wrong (don't give them the answer though) and ask
        > them to try again. He/she can always come back to the newsgroup with
        > additional questions should he/she have any. Doing it this way, you will
        > have actually helped the person to learn.
        >
        > Sorry about being so harsh with you, but this kind of thing is a pet peeve
        > of mine.
        >
        > Rick - MVP
        >
        >
        > "Stephane Richard" <stephane.richa rd@verizon.net> wrote in message
        > news:4%DPa.600$ Kw1.411@nwrdny0 2.gnilink.net.. .[color=green]
        > > Hi Miro,
        > >
        > > Here it is.
        > >
        > > Public Function Find(L As ListBox, Number As Integer ) As Integer
        > >
        > > Dim WorkNumber As Integer
        > > Dim Counter As Integer
        > >
        > > WorkNumber = 0
        > > For Counter = 0 to L.ListCount
        > > If L.ListItem(Coun ter) = Number Then
        > > WorkNumber = WorkNumber + 1
        > > End If
        > > Next Counter
        > > Find = WorkNumber
        > >
        > > End Function
        > >
        > > --
        > > Stéphane Richard
        > > Senior Software and Technology Supervisor
        > > http://www.totalweb-inc.com
        > > For all your hosting and related needs
        > > "Miro" <Miroslav.Ovani n@public.srce.h r> wrote in message
        > > news:ben0i0$qsd $1@bagan.srce.h r...[color=darkred]
        > > > I need code example for: how many times number repeat in the list? It[/color][/color]
        > must[color=green][color=darkred]
        > > > be declared as:
        > > >
        > > > Public Function Find(L As ListBox, Number As Integer ) As Integer
        > > >
        > > > Sorry on my badly english, im from Croatia!
        > > > P.S. I need this for exam!
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...