473,499 Members | 1,659 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

keep a tally in VB .net??

3 New Member
I need a function that will count how many times a user clicks a certain control.

For an example, there is a button that randomly displays 1 of 4 messages in a text box. I want another label to tally how many times one of the messages is displayed?

vb .net
Mar 5 '08 #1
1 1382
demaus
6 New Member
You didn't specify how your text was stored originally. Here is a quick example using a string array. This will tally how many times the first text string shows up.

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2. Dim TextShown As Integer
  3.  
  4. Dim TextToShow() As String = {"First line of Text to show.", "Second line of Text to show.", "Third line of Text to show.", "Fourth line of Text to show."}
  5.  
  6. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnChange.Click
  7.  
  8. Try
  9.  
  10. Dim rd As New Random(Now.Millisecond)
  11.  
  12. Dim intValue As Integer = rd.Next(0, 3)
  13.  
  14. txtToChange.Text = TextToShow(intValue)
  15.  
  16. If intValue = 0 Then TextShown += 1
  17.  
  18. lblCount.Text = TextShown.ToString
  19.  
  20. Catch ex As Exception
  21.  
  22. End Try
  23.  
  24. End Sub
  25.  
  26. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  27.  
  28. lblCount.Text = ""
  29.  
  30. TextShown = 0
  31.  
  32. End Sub
  33.  
  34. End Class
  35.  
  36.  
Mar 5 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2270
by: Ronald | last post by:
Hi there, I would like to challenge you all to make the fastest tally-function possible. The function should count the number of times a specified string is present within another string. As I'm...
1
3243
by: Shannan Casteel via AccessMonster.com | last post by:
If I had 2 tables, one that displayed ClaimNo, PartNo, and Quantity, and another that just has PartNo and Quantity, how could I get Access to search for the PartNo in table 2 that was entered in...
0
1547
by: vidhyapriya | last post by:
hi all i want to connect tally software in my .net application...i want to transfer data between tally software and by windows apllication(or)web application...i heard is it possible to do using...
1
1624
sheenattt
by: sheenattt | last post by:
Hello all, How can I use Tally in .Net?I want to map Tally to web based application,means is it possible to click a link and we can import or export tally to web.I want to put authentication also...
1
4275
by: Hypnotik | last post by:
Well on to my next program. The program tally's votes on 3 issues. I have a class for the interface (asks questions) and a class for adding the tallies. In main there is a counter of Tally data...
3
3214
by: pub | last post by:
Hello..im a junior programmer( a beginner) in .NET C#..... so i really dono hw to use tally 9...so plzzzzz witot any set bak help me in learning n handling tally 9......plzzzz provide me de links...
9
21300
by: sathikbasha | last post by:
hi Please help me !!!!!!! how to connect the Tally from VB. Is there any ODBC connection in Tally Software. I need to import the data from SQL Server to Tally. regards
4
9899
by: shailendraedreamz | last post by:
Hi, As in .Net we can connect to Oracle database using OracleClient Name Space. In the same manner can we connect to Tally database directly. Is .Net have provided such facility??
1
2543
by: Vikrant kale | last post by:
I have created a accounting software in asp.net with sql server 2005 database . my customer is already using tally 9.0 and he want to integrate tally to my database to reduce double entry. ...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3108
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.