Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VB counters

Options
  • 12-04-2001 10:09am
    #1
    Registered Users Posts: 179 ✭✭


    Where would I go to get some guidance about activating a counter on forms? The counter works only when using the form and when the program ends the counter resets to zero.


«1

Comments

  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    Can we have some more info?

    What exactly are you trying to do?

    From mk:@MSITStore:C:\Program%20Files\Microsoft%20Visual%20Studio\MSDN98\98VS\1033
    <font face="Verdana, Arial" size="2">
    Counters Component
    The Counter component creates a Counters object that can create, store, increment, and retrieve any number of individual counters.

    A counter is a persistent value that contains an integer. You can manipulate a counter with the Get, Increment, Set, and Remove methods of the Counters object. Once you create the counter, it persists until you remove it.

    Counters do not automatically increment on an event like a page hit. You must manually set or increment counters using the Set and Increment methods.

    Counters are not limited in scope. Once you create a counter, any page on your site can retrieve or manipulate its value. For example, if you increment and display a counter named hits in a page called Page1.asp, and you increment hits in another page called Page2.asp, both pages will increment the same counter. If you hit Page1.asp, and increment hits to 34, hitting Page2.asp will increment hits to 35. The next time you hit Page1.asp, hits will increment to 36.

    All counters are stored in a single text file, counters.txt, which is located in the same directory as the counters.dll file.

    File Names
    counters.dll The Counters component.
    counters.txt The file that stores all individual counters on a site. counters.txt is a UTF8-encoded file. You can have any Unicode characters in a counter name.


    Syntax
    Create the Counters object one time on your server by adding the following to the global.asa file:

    <OBJECT
    RUNAT=Server
    SCOPE=Application
    ID=Counter
    PROGID="MSWC.Counters">
    </OBJECT>
    Registry Entries
    None.

    Remarks
    Only create one Counters object in your site. This single Counters object can create any number of individual counters.

    Note For Personal Web Server on Windows® 95, a Counters component has already been specified in the global.asa file in the default virtual directory. You can work with the Counters object the component creates as if it were a built-in object by calling Counters.Get, Counters.Increment, Counters.Remove, and Counters.Set . You should not create another instance of the Counters object.

    Methods
    Get Returns the value of the counter.
    Increment Increases the counter by 1.
    Remove Removes the counter from the counters.txt file.
    Set Sets the value of the counter to a specific integer.


    Example
    Create an instance of the Counters object in the global.asa file with the ID attribute set to Counter:

    <OBJECT RUNAT=Server SCOPE=Application ID=Counter PROGID="MSWC.Counters"> </OBJECT>

    You can then use that Counters object on one page to create all the counters you need:

    There have been <%= Counter.Increment('defaultPageHits') %> to this site.

    Then on another page you can increment the counter in the following manner:

    You are visitor number<%= Counter.Increment('LinksPageHits') %> to this page.

    Note You can obtain this component from the CD included with the IIS Resource Kit.

    </font>



    [This message has been edited by Trojan (edited 12-04-2001).]


  • Registered Users Posts: 2,494 ✭✭✭kayos


    Haha Al is a vb muppet smile.gif Sysprog my .... eye

    kayos


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    <font face="Verdana, Arial" size="2">Originally posted by kayos:
    Haha Al is a vb muppet smile.gif Sysprog my .... eye

    kayos
    </font>

    And what do you do?



  • Registered Users Posts: 2,494 ✭✭✭kayos


    I'm a bigger VB muppet smile.gif and also a DBA and OLAP kinda guy its just Al is always pulling the **** out of me for being a Vb programmer

    Kayos


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    <font face="Verdana, Arial" size="2">Originally posted by kayos:
    I'm a bigger VB muppet smile.gif and also a DBA and OLAP kinda guy its just Al is always pulling the **** out of me for being a Vb programmer

    Kayos
    </font>

    My Apologies. Was in VB myself for 3 years so I kinda get defensive.

    Nothing muppety about VB though, Windows programming is never easy.


  • Advertisement
  • Closed Accounts Posts: 9,314 ✭✭✭Talliesin


    Yes.
    It's kind of weird how they do all this stuff to protect you from yourself and then you end up using the same API calls most of the controls wrapped around anyway.

    Anyway, can topgold be more specific, we seem to have enough "VB muppets" to help if he can smile.gif

    [This message has been edited by Talliesin (edited 12-04-2001).]


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Yeah, Topgold. Whaddaya trying to do?


  • Registered Users Posts: 2,494 ✭✭✭kayos


    Well VB programming is easy if its just basic forms and stuff like that. But when it comes to the stuff I do and Daqv can vouch for this it aint easy smile.gif


  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    Bah!

    You are all VB muppets!

    Muppets of VB, are you!

    Al.



  • Closed Accounts Posts: 88 ✭✭PostmanPat


    VB is for muppets anyways. It was designed by Microsoft for god sake !! It's a programming "language" for idiots who don't know how to program properly and don't have the intelligence to learn a proper language like C, C++, Java etc.

    You just have to click buttons, make boxes and write tiny subs, like what type of a language is that??



    A controversial operation to transplant the whole head of a monkey onto a
    different body has proved a partial success.


  • Advertisement
  • Registered Users Posts: 2,494 ✭✭✭kayos


    Hey Postman I know VB can be a easy lang but it is powerful as well just because your the big man and know C/C++ or what ever you know doesn't give the write to slag VB. I use VB in work and we have full call centers running 100+ ops on a VB system. I know other langs (C/C++/ASM/Open Script/Install Script/SQL/MDX) and I know that each Lang has its uses. EG I would never write a Device Driver and any hardware related prog in VB. But on the other hand why write use C/C++ to write a simple front end for say automaticly updating a Web Site which would take ages or I could knock one together in a couple of minutes in VB. Catch my drift...

    Edit
    BTW I can program so dont any me my saying anyone who uses VB cann't program
    End Edit



    [This message has been edited by kayos (edited 16-04-2001).]


  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    <font face="Verdana, Arial" size="2">Originally posted by kayos:
    why write use C/C++ to write a simple front end for say automaticly updating a Web Site which would take ages or I could knock one together in a couple of minutes in VB.
    </font>


    Bah, you can't use arrays of function pointers in VB ffs! What's your point, damnit?

    Al.



  • Moderators, Social & Fun Moderators Posts: 10,501 Mod ✭✭✭✭ecksor


    He's saying it's faster to develop with. What's your point? Using an array of function pointers may be handy for ... oh, I dunno, a Finite State Machine or something like that, but using a language which makes the task at hand easier is a good thing, especially when you want to get the job done quickly.

    As for saying, "It's not a real programming language like C/C++/Java" as someone did earlier, that's just being narrow minded.
    It's not a real programming language because it doesn't have curly braces and it doesn't require a big book beside you to figure out the syntax of the language when you start using it? Well, if you think that "real" programming is about figuring out weird syntax, and doing things the hard way, then you're really in the wrong job. Programming is about solving problems, and figuring out the best way to get the job done. Sometimes that's C or C++ or Java, but being easy to use is not a reason to call a langauge crap. The language should make it easy to solve the problem, not get in the way so that you have difficulty expressing the best way of solving the problem.

    I can imagine the conversation that would follow doing the above mentioned web update front end in C++ rather than VB.

    Boss: Why did that take a few days longer than expected?
    Programmer: Well, cos I did it in C++ instead of VB, which takes longer to program in, but look, it runs a whole 3/4 of a second faster!
    Boss: Why does it crash after I use it a few times?
    Programmer: Well, I haven't tracked down that memory leak yet, but another day or two ...
    Boss: You're fired.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    <font face="Verdana, Arial" size="2">Originally posted by PostmanPat:
    You just have to click buttons, make boxes and write tiny subs, like what type of a language is that??
    </font>

    And what do you do, exactly?

    That's not a valid argument, there's a lot more to vb than that. Seems to me, people who want to be considered 'real' programmers slag vb. People who know software development know what language suits what situation. You don't.

    [This message has been edited by Evil Phil (edited 17-04-2001).]


  • Closed Accounts Posts: 88 ✭✭PostmanPat


    Well come on lads don't get yer nickers in a twist, if ye're not able to program properly well then VB is the language for you !! I'm not critising ye it's the crappy Microsoft products designed for people without 2 brain cells to rub together and the assumptions that people can't understand the basics of computers. Lets face it most people can't.

    BTW i'm a computer eng. student so if any ye science students can't understand what any of the above words mean just ask...

    A controversial operation to transplant the whole head of a monkey onto a
    different body has proved a partial success.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    VB is easy to learn. Because of that it might have a higher ratio of muppets then say C++ however C++ has people who can't code but seem to think they are gods gift because they know how to write in C++ (writing/reading + coding are all different).

    But anyone who does serious coding in VB will tell you that there is more to creating an application then putting buttons on Form1.

    I had one such muppet in an old job. I had written an application to control a special machine, written in VB7 (For DOS. Give you an idea of how long ago smile.gif ). Took 40 minutes to write, and worked perfectly. A new guy we had in said the program sucked because "It was written in BASIC" so he wrote it in C. Took him 3 days to copy what my program did. Btw VB7 compiled to pure assembly language, wasn't a wrapper at all. Shame it died off.

    Another nice thing about VB is it is easy to transition to ASP then it is to learn Java/Perl from scratch.

    Here is what I feel what should be used for coding.
    1. Speed of program :- Asm, C++.
    2. Fast creation :- VB.

    Now with VB I can link into the ASM & C++ functions, so you can have one coder do the speed stuff while another codes the application.

    The only other things your application really needs to be is...

    1. Readable. Anyone with the knowledge in the language can sit down and update/fix/change portions of the code without having to do major rewrites or decode some cryptic piece of code. This includes Remarks+proper coding convention (even VB has it).

    2. Localisation ability. You would be surprised at the large number of people who code applications to only work in thier locale.

    3. OO. In that a coder can update one object without causing breaks across other objects which aren't really part of that object.


  • Registered Users Posts: 2,494 ✭✭✭kayos


    Postman you really know how to get peoples knickers in a twist and you go and do it again.
    <font face="Verdana, Arial" size="2">
    if ye're not able to program properly well then VB is the language for you
    </font>
    This is bull did you ever here the expression "using a sledge hammer to kill a fly" well in certain cases C/C++/Java is the wrong lang for a problem.
    <font face="Verdana, Arial" size="2">
    not critising ye it's the crappy Microsoft products designed for people without 2 brain cells to rub together
    </font>
    Again untrue I hate when people totaly forget if it wasn't for microsoft and their "easy to use" software most ppl would not be using PC's today. Also their software is designed for ease of use. EG Intelli Sence in Visual Studio you say for muppets who cann't remember the Object models. I say less typing and less room for typo's.
    <font face="Verdana, Arial" size="2">
    BTW i'm a computer eng. student so if any ye science students can't understand what any of the above words mean just ask...
    </font>
    BTW I'm a Electronic Engineer with near 4 years work exp. and I know more about the internals of a PC than you me boy.

    I dont like certain Lang's (COBOL) but I wont dis the lang because a hell of a lot of software in the world is written in it and it is just a personal prefrence.

    The main point is use the tool that best suite the job and be prepered to use a lang that you dont like in the work enviroment. No boss will give you free reign if they ask you to develop a program with a nice user interface and easy to use and quickly and at the same time askes someone to do it in vb. By the time the vb version is finished you might have a version that runs form the command line and crashs left right and center. Who do you think the boss will keep on???

    kayos


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    <font face="Verdana, Arial" size="2">Originally posted by PostmanPat:
    if ye're not able to program properly well then VB is the language for you !! </font>

    Why?
    <font face="Verdana, Arial" size="2">
    I'm not critising ye it's the crappy Microsoft products designed for people without 2 brain cells to rub together and the assumptions that people can't understand the basics of computers.
    </font>

    Would this include Visual C++? Or how about a spell checker? You don't seem to be able to use one.
    BTW: Microsoft could make you a good living, if you survive in the real world.
    <font face="Verdana, Arial" size="2">
    BTW i'm a computer eng. student so if any ye science students can't understand what any of the above words mean just ask...
    </font>

    Did that, been there. Have 4 years Software Development experience since then both VB and Java. You don't know what your talking about, plain and simple, reason being: you're still in the soft fluffy world of college and not earning a salary doing real world development. Don't second guess developers until you become one.

    In short, you're a muppet. icon19.gif

    [edited to include sticky out tongue insult]


    [This message has been edited by Evil Phil (edited 17-04-2001).]


  • Closed Accounts Posts: 88 ✭✭PostmanPat


    Come on Kayos
    <font face="Verdana, Arial" size="2">Originally posted by kayos:
    Again untrue I hate when people totaly forget if it wasn't for microsoft and their "easy to use" software most ppl would not be using PC's today. Also their software is designed for ease of use. EG Intelli Sence in Visual Studio you say for muppets who cann't remember the Object models. I say less typing and less room for typo's.
    kayos[/B]</font>


    that's what i mean, if you want 'easy to use' you shouldn't be using a computer... Microsoft, by creating "user-friendly" apps degraded the computer and decreased the functionality and power by adding lots of crap noone needs or uses...

    Linux therefore is the opposite and thus augments the power and usefulness of the computer.




    A controversial operation to transplant the whole head of a monkey onto a
    different body has proved a partial success.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    <font face="Verdana, Arial" size="2">
    that's what i mean, if you want 'easy to use' you shouldn't be using a computer...
    </font>

    ROFLMAO. Jesus are you in for a shock!


  • Advertisement
  • Registered Users Posts: 2,494 ✭✭✭kayos


    I think your are missing the whole point of computers. Computers are ment to make peoples lives easier. Example a sectary wants to write a letter to all the people in the address book for a company. WHat does she do a nice and easy mail merge where as with out a PC she would be doing a lot of typing on a old typewriter ffs. PC are there to make life easier to help in work and help in research and also to help in entertainment.

    I have a back ground in finical services and atm we're doing a system for one of the biggest underwriters in Ireland and they cann't wait to move from a old dibol system running on vms to a windows platform. Why because windows makes life easier?? I know linux/unix are more powerful but hey a car with nothing but the bare min will go faster than one weight down with a nice body and nice "easy to use" features but hey I want a body on my car and I also want a radio and a heater as these things make life plesent/easier.

    kayos


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Kayos is right. Ease of use is what has made I.T. so popular, if you had to be a Sys Admin or a C++ coder to use a computer then there would be very few uses for a computer, and as such there very few uses for you Postman Pat. Ease-of-use gave us end-users. End-users gave us jobs. It's that simple.

    And just because Microsoft Word makes things easy does not mean that VB is not a real programming language. Powerful can mean overkill. And just because you know really technical stuff does not mean you'll be good.


  • Moderators, Social & Fun Moderators Posts: 10,501 Mod ✭✭✭✭ecksor


    <font face="Verdana, Arial" size="2">Originally posted by PostmanPat:
    Linux therefore is the opposite and thus augments the power and usefulness of the computer.</font>

    Oh key-riste, Windows might be bad, but is that the best OS you can come up with as the best solution? Catch a clue you complete muppet. At least pretend to know about a respectable OS to not appear so inexperienced. How many languages have you actually used to program anything non-trivial? How many OSs have you adminned or used seriously for more than a few days?

    I would consider Unix and C to be two of my strongest skills, but that doesn't make them the best tools for every job. As I said, it's about problem solving.

    I suppose you look at Star Trek and think "Pah, telling the computer what to do? They should be getting down and dirty with some ASM and a C Compiler." I'm not saying that VB is the dog's ****** (far from it), but it's damn handy for a lot of things and still requires a competent programmer to do anything complicated. As computers become more powerful and we want them to do more and more complex tasks, C just isn't going to cut the mustard for most applications. Either realise that or be a dinosaur maintaining legacy systems for the rest of your life.

    Btw, what's your opinion on Visual Development tools for Java etc?


  • Moderators, Social & Fun Moderators Posts: 28,633 Mod ✭✭✭✭Shiminay


    d00d - don't knock VB - it's a bit muppety (the stuff you'll learn when you're a beginner), but I've seen some of the source code Kayos (and the other developers in our company) write and there's nothing muppety or easy-to-use about it! Programming through the API and stuff like that - it's as low level as C or C++ The Development tools (i.e. Visual Studio) are good and make life easier.

    Anyway - I'm a HTML programmer - what would I know?!?!!? tongue.giftongue.giftongue.gif

    * Note: *
    The above statement is indeed a big dirty lie. I know bits and pieces of the following: Pascal, Delphi, C, C++, VB, Perl, PHP, Java, Java-Script, SQL, MySQL, Oracle PL/SQL (ok, so I'm clenching at straws in the last 3) so I think it's fair to say I've got a broad exposure to programming languages.

    VB's grand and handy in it's place. C is grand and handy in it's place. Learn to live with it!

    Anyway - poor old topgold wanted some help with something and it's turned into a religious war!!!



    All the best,

    Dav
    @B^)
    <font face="Verdana, Arial" size="2">Prepare yourself - The Beefy King stirs from his slumber...</font>

    [honey i] violated [the kids]


  • Moderators, Social & Fun Moderators Posts: 28,633 Mod ✭✭✭✭Shiminay


    damn double post frown.gif

    [This message has been edited by Kharn (edited 17-04-2001).]


  • Registered Users Posts: 10,501 ✭✭✭✭Slydice


    <font face="Verdana, Arial" size="2">Originally posted by Kharn:

    I know bits and pieces of the ....
    </font>

    biggrin.gifbiggrin.gifbiggrin.gifAh only bits and pieces so yer only a technician so tongue.gif
    biggrin.gifbiggrin.gifbiggrin.gif


  • Closed Accounts Posts: 88 ✭✭PostmanPat


    Come on Lads, just pulling the p1ss, why do you think I was looking up this post in the first place??

    I'm learning VB, myself, for a job this summer !!
    God lads, ye do get hot under the collar about computers, their tools lads so you can do cool things like this now calm down take a hot bath, lots of radox and forget this ikkle converstaion ever happened !!!




    A controversial operation to transplant the whole head of a monkey onto a
    different body has proved a partial success.


  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    <font face="Verdana, Arial" size="2">Originally posted by X_OR:
    As I said, it's about problem solving.
    </font>

    Personally I think it's all about Budget.

    Although trying to problem solve how to get something coded in X amount of time with Y amount of money is requires some serious problem solving. smile.gif

    Btw, if you really want to program I would recommend trying every language. Love them or hate them, at least try them and understand how they work.

    [This message has been edited by Hobbes (edited 17-04-2001).]


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Well don't slag vb again, or you'll be sent to bed with no supper!


  • Advertisement
  • Closed Accounts Posts: 218 ✭✭Void


    I think this is the third VB "debate" the programming board has had. Well, I ain't saying nothing...

    Anyways, nobody seems to have answered the man's question, so I'll have a go.
    Topgold, you weren't very specific, but I think the solution is rather simple. Lash a timer control onto the form, set it to tick every second. In the Timer_Event function, increment a variable and Robert is your father's brother. Hmmm, that sounds too easy, my apologies if it's too simplistic a solution.

    Oops, I missed a bit. I suppose the difficult bit is deciding when the form is being used, dunno how this may be done, but maybe activating/deactivating the timer in the Form_Activate/Deactivate event might be one way. Then again, just because the form is currently being displayed doesn't mean the user is interacting with it. Hope that helped.

    [This message has been edited by Void (edited 17-04-2001).]


Advertisement