Count Equal Numbers in Text box How ?

Hey guys,
I want to Know is there any way to Count Similar Numbers which entered in single textbox in VB6

as a example; i have textbox named txt1 in that user can type any value (2,12,23,2,34,12,2,2,23,54,12....) (separate the values by adding ",").when the user click the command button, i want to get the Count of those Numbers to in a textbox or label.(like or Eg : 2's are=4, 12's are =3, 23's are =2.. Etc..

i searched over the internet and found Not Proper Result. plese help me... Thank U.

Recommended Answers

All 4 Replies

Which programming language/version are you using?

Assuming the numbers are separated by a comma, you could split the string into separate numeric string by

Dim nums() As String = tbx.Nums.Text.Split(",")

Then you could create a dictionary, iterate over the strings and add/increment the count for each unique string in the dictionary.

Sir, i am Using VB 6.. and also New to Programing.

Then I suggest you read up on Split and dictionaries. i'm not going to write the code for you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.